shukdevdatta123 commited on
Commit
f11f22a
·
verified ·
1 Parent(s): b0b2a27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -62,6 +62,29 @@ if sidebar_option == "Introductory Tutorial":
62
  # Display a logo or icon
63
  image = Image.open("1.png") # Path to your image file
64
  st.image(image, width=200) # You can adjust the width as needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  # Add content descriptions
67
  descriptions = [
@@ -101,29 +124,6 @@ if sidebar_option == "Introductory Tutorial":
101
  st.write(desc)
102
  st.write("---")
103
 
104
- # Add the Bubble Sort Simulator button
105
- if st.button("Bubble Sort Simulator"):
106
- st.title("Bubble Sort with Animation")
107
-
108
- # Get input array from user
109
- user_input = st.text_input("Enter the array elements separated by spaces:")
110
- if user_input:
111
- arr = list(map(int, user_input.split()))
112
-
113
- # Ask the user if they want an animation
114
- animate_option = st.radio("Do you want to see the animation?", ("Yes", "No"))
115
- animate = animate_option == 'Yes'
116
-
117
- # Perform bubble sort and get the steps for animation
118
- sorted_array, steps = bubble_sort(arr, animate)
119
-
120
- # Display the sorted array
121
- st.write("Sorted Array:", sorted_array)
122
-
123
- # Show animation if required
124
- if animate:
125
- animate_sorting(arr, steps)
126
-
127
  def plot_greedy_coloring(graph):
128
  # Apply greedy coloring
129
  graph_coloring = nx.greedy_color(graph)
 
62
  # Display a logo or icon
63
  image = Image.open("1.png") # Path to your image file
64
  st.image(image, width=200) # You can adjust the width as needed
65
+
66
+ # Add the Bubble Sort Simulator button
67
+ if st.button("Bubble Sort Simulator"):
68
+ st.title("Bubble Sort with Animation")
69
+
70
+ # Get input array from user
71
+ user_input = st.text_input("Enter the array elements separated by spaces:")
72
+ if user_input:
73
+ arr = list(map(int, user_input.split()))
74
+
75
+ # Ask the user if they want an animation
76
+ animate_option = st.radio("Do you want to see the animation?", ("Yes", "No"))
77
+ animate = animate_option == 'Yes'
78
+
79
+ # Perform bubble sort and get the steps for animation
80
+ sorted_array, steps = bubble_sort(arr, animate)
81
+
82
+ # Display the sorted array
83
+ st.write("Sorted Array:", sorted_array)
84
+
85
+ # Show animation if required
86
+ if animate:
87
+ animate_sorting(arr, steps)
88
 
89
  # Add content descriptions
90
  descriptions = [
 
124
  st.write(desc)
125
  st.write("---")
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  def plot_greedy_coloring(graph):
128
  # Apply greedy coloring
129
  graph_coloring = nx.greedy_color(graph)