Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,11 @@
|
|
1 |
import streamlit as st
|
2 |
import random
|
3 |
from colors import *
|
4 |
-
from
|
5 |
-
from
|
6 |
-
from
|
7 |
-
from
|
8 |
-
|
9 |
-
from algorithms.countingSort import counting_sort
|
10 |
-
from algorithms.radixSort import radix_sort
|
11 |
-
from algorithms.heapSort import heap_sort
|
12 |
-
from algorithms.bucketSort import bucket_sort
|
13 |
-
from algorithms.shellSort import shell_sort
|
14 |
|
15 |
# Create a Streamlit app
|
16 |
st.set_page_config(page_title='Sorting Algorithms Visualization', layout='wide')
|
@@ -59,37 +54,19 @@ def sort():
|
|
59 |
time_tick = set_speed()
|
60 |
algorithm = st.selectbox('Select Sorting Algorithm', [
|
61 |
'Bubble Sort',
|
62 |
-
'Merge Sort',
|
63 |
'Selection Sort',
|
64 |
'Insertion Sort',
|
65 |
-
'Quick Sort'
|
66 |
-
'Counting Sort',
|
67 |
-
'Radix Sort',
|
68 |
-
'Heap Sort',
|
69 |
-
'Bucket Sort',
|
70 |
-
'Shell Sort'
|
71 |
])
|
72 |
|
73 |
if algorithm == 'Bubble Sort':
|
74 |
bubble_sort(data, draw_data, time_tick)
|
75 |
-
elif algorithm == 'Merge Sort':
|
76 |
-
merge_sort(data, 0, len(data)-1, draw_data, time_tick)
|
77 |
elif algorithm == 'Selection Sort':
|
78 |
selection_sort(data, draw_data, time_tick)
|
79 |
elif algorithm == 'Insertion Sort':
|
80 |
insertion_sort(data, draw_data, time_tick)
|
81 |
elif algorithm == 'Quick Sort':
|
82 |
quick_sort(data, 0, len(data)-1, draw_data, time_tick)
|
83 |
-
elif algorithm == 'Counting Sort':
|
84 |
-
counting_sort(data, draw_data, time_tick)
|
85 |
-
elif algorithm == 'Radix Sort':
|
86 |
-
radix_sort(data, draw_data, time_tick)
|
87 |
-
elif algorithm == 'Heap Sort':
|
88 |
-
heap_sort(data, draw_data, time_tick)
|
89 |
-
elif algorithm == 'Bucket Sort':
|
90 |
-
bucket_sort(data, len(data), draw_data, time_tick)
|
91 |
-
elif algorithm == 'Shell Sort':
|
92 |
-
shell_sort(data, draw_data, time_tick)
|
93 |
|
94 |
# Streamlit buttons and actions
|
95 |
if st.button('Generate Array'):
|
|
|
1 |
import streamlit as st
|
2 |
import random
|
3 |
from colors import *
|
4 |
+
from bubbleSort import bubble_sort
|
5 |
+
from selectionSort import selection_sort
|
6 |
+
from insertionSort import insertion_sort
|
7 |
+
from quickSort import quick_sort
|
8 |
+
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# Create a Streamlit app
|
11 |
st.set_page_config(page_title='Sorting Algorithms Visualization', layout='wide')
|
|
|
54 |
time_tick = set_speed()
|
55 |
algorithm = st.selectbox('Select Sorting Algorithm', [
|
56 |
'Bubble Sort',
|
|
|
57 |
'Selection Sort',
|
58 |
'Insertion Sort',
|
59 |
+
'Quick Sort''
|
|
|
|
|
|
|
|
|
|
|
60 |
])
|
61 |
|
62 |
if algorithm == 'Bubble Sort':
|
63 |
bubble_sort(data, draw_data, time_tick)
|
|
|
|
|
64 |
elif algorithm == 'Selection Sort':
|
65 |
selection_sort(data, draw_data, time_tick)
|
66 |
elif algorithm == 'Insertion Sort':
|
67 |
insertion_sort(data, draw_data, time_tick)
|
68 |
elif algorithm == 'Quick Sort':
|
69 |
quick_sort(data, 0, len(data)-1, draw_data, time_tick)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
# Streamlit buttons and actions
|
72 |
if st.button('Generate Array'):
|