gokaymeydan commited on
Commit
7e4feb9
·
1 Parent(s): 7721184

Update app.py layout and fix visual alignment

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -107,12 +107,25 @@ if st.button("Compare Insertion Sort vs Merge Sort"):
107
  for j in range(length)
108
  ]
109
 
110
- st.subheader("Insertion Sort Visualization")
111
  st.plotly_chart(create_animation(steps_insertion, "Insertion Sort", insertion_colors))
112
 
113
- st.subheader("Merge Sort Visualization")
114
  st.plotly_chart(create_animation(steps_merge, "Merge Sort", merge_colors))
115
 
116
  st.subheader("About the Algorithms")
117
- st.markdown("**Insertion Sort:** A simple comparison-based algorithm that builds the sorted list one element at a time. Best for small or nearly sorted datasets. Time complexity: O(n²).")
118
- st.markdown("**Merge Sort:** A divide-and-conquer algorithm that recursively splits the list and merges them in sorted order. Efficient for large datasets. Time complexity: O(n log n).")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  for j in range(length)
108
  ]
109
 
 
110
  st.plotly_chart(create_animation(steps_insertion, "Insertion Sort", insertion_colors))
111
 
 
112
  st.plotly_chart(create_animation(steps_merge, "Merge Sort", merge_colors))
113
 
114
  st.subheader("About the Algorithms")
115
+ st.markdown("**Insertion Sort**")
116
+ st.markdown("""
117
+ - Simple comparison-based sorting algorithm
118
+ - Builds the sorted array one element at a time
119
+ - In-place and stable
120
+ - Best case: Θ(n) when the array is already sorted
121
+ - Worst case: Θ(n²) when the array is reverse sorted
122
+ """)
123
+
124
+ st.markdown("**Merge Sort**")
125
+ st.markdown("""
126
+ - Divide-and-conquer algorithm
127
+ - Recursively splits the array and merges sorted halves
128
+ - Stable but not in-place
129
+ - Consistently performs in Θ(n log n) time in all cases
130
+ - Requires additional memory for merging
131
+ """)