Skip to content

Commit 63ea447

Browse files
committed
Bubble Sort Visualization#2
1 parent 2cacafd commit 63ea447

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+15688
-2
lines changed

Code-ologists/README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,30 @@ PyDSA Visualization Examples
66
**Team Members**: Kanika Murarka ( _@kanikaa1234 )
77
Anika Murarka (_@anikamurarka )
88
<br>
9-
**Algorithm Implemented**: Bubble Sort
10-
9+
**Algorithm Implemented**:
10+
11+
1. Bubble Sort (python and matplotlib)
12+
13+
```
14+
$ python bubble_sort.py
15+
```
16+
17+
2. Bubble Sort (Django and javascript)
18+
19+
```
20+
$ cd Code-ologists
21+
$ ./startserver.sh
22+
```
23+
When page is open:- (http://127.0.0.1:8000/)
24+
+ go to url http://127.0.0.1:8000/sort
25+
+ Click on Bubble Sort
26+
27+
Some features :-
28+
+ Whenever you RELOAD the page, you will see distinct colors.
29+
+ Every iteartion is visible
30+
+ Hover on the bars to see the number that is sorted
31+
+ Nothing is hard coded
32+
33+
34+
35+

Code-ologists/pydsa/db.sqlite3

38 KB
Binary file not shown.

Code-ologists/pydsa/manage.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pydsa.settings")
7+
8+
from django.core.management import execute_from_command_line
9+
10+
execute_from_command_line(sys.argv)

Code-ologists/pydsa/pydsa/__init__.py

Whitespace-only changes.

Code-ologists/pydsa/pydsa/settings.py

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
"""
2+
Django settings for pydsa project.
3+
4+
Generated by 'django-admin startproject' using Django 1.8.2.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.8/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/1.8/ref/settings/
11+
"""
12+
13+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
14+
import os
15+
16+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = '-ne26dve^qu6*fgdnmcn+%d5^mtixj9muzl@40@v6epl1*c7&f'
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = []
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = (
34+
'django.contrib.admin',
35+
'django.contrib.auth',
36+
'django.contrib.contenttypes',
37+
'django.contrib.sessions',
38+
'django.contrib.messages',
39+
'django.contrib.staticfiles',
40+
'sort',
41+
)
42+
43+
MIDDLEWARE_CLASSES = (
44+
'django.contrib.sessions.middleware.SessionMiddleware',
45+
'django.middleware.common.CommonMiddleware',
46+
'django.middleware.csrf.CsrfViewMiddleware',
47+
'django.contrib.auth.middleware.AuthenticationMiddleware',
48+
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
49+
'django.contrib.messages.middleware.MessageMiddleware',
50+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
51+
'django.middleware.security.SecurityMiddleware',
52+
)
53+
54+
ROOT_URLCONF = 'pydsa.urls'
55+
56+
TEMPLATES = [
57+
{
58+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
59+
'DIRS': [os.path.join(BASE_DIR,'templates')],
60+
'APP_DIRS': True,
61+
'OPTIONS': {
62+
'context_processors': [
63+
'django.template.context_processors.debug',
64+
'django.template.context_processors.request',
65+
'django.contrib.auth.context_processors.auth',
66+
'django.contrib.messages.context_processors.messages',
67+
],
68+
},
69+
},
70+
]
71+
72+
WSGI_APPLICATION = 'pydsa.wsgi.application'
73+
74+
75+
# Database
76+
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
77+
78+
DATABASES = {
79+
'default': {
80+
'ENGINE': 'django.db.backends.sqlite3',
81+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
82+
}
83+
}
84+
85+
86+
# Internationalization
87+
# https://docs.djangoproject.com/en/1.8/topics/i18n/
88+
89+
LANGUAGE_CODE = 'en-us'
90+
91+
TIME_ZONE = 'UTC'
92+
93+
USE_I18N = True
94+
95+
USE_L10N = True
96+
97+
USE_TZ = True
98+
99+
100+
# Static files (CSS, JavaScript, Images)
101+
# https://docs.djangoproject.com/en/1.8/howto/static-files/
102+
103+
STATIC_ROOT = os.path.join(BASE_DIR,'sort/static')
104+
STATIC_URL = '/static/'
105+
STATICFILES_DIRS = (
106+
os.path.join(BASE_DIR, 'staticfiles'),
107+
)
108+
STATICFILES_FINDERS = (
109+
'django.contrib.staticfiles.finders.FileSystemFinder',
110+
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
111+
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
112+
)
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
"""
2+
Django settings for pydsa project.
3+
4+
Generated by 'django-admin startproject' using Django 1.8.2.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.8/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/1.8/ref/settings/
11+
"""
12+
13+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
14+
import os
15+
16+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = '-ne26dve^qu6*fgdnmcn+%d5^mtixj9muzl@40@v6epl1*c7&f'
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = []
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = (
34+
'django.contrib.admin',
35+
'django.contrib.auth',
36+
'django.contrib.contenttypes',
37+
'django.contrib.sessions',
38+
'django.contrib.messages',
39+
'django.contrib.staticfiles',
40+
'sort',
41+
)
42+
43+
MIDDLEWARE_CLASSES = (
44+
'django.contrib.sessions.middleware.SessionMiddleware',
45+
'django.middleware.common.CommonMiddleware',
46+
'django.middleware.csrf.CsrfViewMiddleware',
47+
'django.contrib.auth.middleware.AuthenticationMiddleware',
48+
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
49+
'django.contrib.messages.middleware.MessageMiddleware',
50+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
51+
'django.middleware.security.SecurityMiddleware',
52+
)
53+
54+
ROOT_URLCONF = 'pydsa.urls'
55+
56+
TEMPLATES = [
57+
{
58+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
59+
'DIRS': [os.path.join(BASE_DIR,'templates')],
60+
'APP_DIRS': True,
61+
'OPTIONS': {
62+
'context_processors': [
63+
'django.template.context_processors.debug',
64+
'django.template.context_processors.request',
65+
'django.contrib.auth.context_processors.auth',
66+
'django.contrib.messages.context_processors.messages',
67+
],
68+
},
69+
},
70+
]
71+
72+
WSGI_APPLICATION = 'pydsa.wsgi.application'
73+
74+
75+
# Database
76+
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
77+
78+
DATABASES = {
79+
'default': {
80+
'ENGINE': 'django.db.backends.sqlite3',
81+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
82+
}
83+
}
84+
85+
86+
# Internationalization
87+
# https://docs.djangoproject.com/en/1.8/topics/i18n/
88+
89+
LANGUAGE_CODE = 'en-us'
90+
91+
TIME_ZONE = 'UTC'
92+
93+
USE_I18N = True
94+
95+
USE_L10N = True
96+
97+
USE_TZ = True
98+
99+
100+
# Static files (CSS, JavaScript, Images)
101+
# https://docs.djangoproject.com/en/1.8/howto/static-files/
102+
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
103+
104+
MEDIA_URL = '/media/'
105+
STATIC_ROOT = os.path.join(BASE_DIR,'sort/static/sort/')
106+
STATIC_URL = '/static/'
107+
STATICFILES_DIRS = (
108+
os.path.join(BASE_DIR, 'staticfiles'),
109+
)
110+
111+

Code-ologists/pydsa/pydsa/urls.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""pydsa URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/1.8/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Add an import: from blog import urls as blog_urls
14+
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
15+
"""
16+
from django.conf.urls import include, url
17+
from django.contrib import admin
18+
19+
urlpatterns = [
20+
url(r'^admin/', include(admin.site.urls)),
21+
url(r'^sort/', include('sort.urls')),
22+
]

Code-ologists/pydsa/pydsa/wsgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for pydsa project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pydsa.settings")
15+
16+
application = get_wsgi_application()

Code-ologists/pydsa/sort/__init__.py

Whitespace-only changes.

Code-ologists/pydsa/sort/admin.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from django.contrib import admin
2+
from sort.models import Sorting
3+
4+
# Register your models here.
5+
class SortAdmin(admin.ModelAdmin):
6+
fields = ['Name','List']
7+
list_display = ('Name','List')
8+
9+
10+
admin.site.register(Sorting, SortAdmin)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
]
11+
12+
operations = [
13+
migrations.CreateModel(
14+
name='Sorting',
15+
fields=[
16+
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
17+
('Name', models.CharField(max_length=50)),
18+
('List', models.CharField(max_length=50)),
19+
],
20+
),
21+
]

Code-ologists/pydsa/sort/migrations/__init__.py

Whitespace-only changes.

Code-ologists/pydsa/sort/models.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from django.db import models
2+
3+
# Create your models here.
4+
5+
6+
class Sorting(models.Model):
7+
Name = models.CharField(max_length=50)
8+
List = models.CharField(max_length=50)
9+
10+
def __str__(self):
11+
return self.Name

0 commit comments

Comments
 (0)