Spaces:
Configuration error
Configuration error
Commit
·
7e4feb9
1
Parent(s):
7721184
Update app.py layout and fix visual alignment
Browse files
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
|
| 118 |
-
st.markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
""")
|