Spaces:
Configuration error
Configuration error
Commit
·
216cc42
1
Parent(s):
5f86dcd
delete main.py
Browse files
main.py
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
from algorithms import insertion_sort
|
| 2 |
-
|
| 3 |
-
my_list = [5, 2, 4, 6, 1, 3]
|
| 4 |
-
steps = insertion_sort(my_list)
|
| 5 |
-
prev = None
|
| 6 |
-
|
| 7 |
-
def print_step(step, prev_step=None):
|
| 8 |
-
for i, num in enumerate(step):
|
| 9 |
-
bar = '█' * num
|
| 10 |
-
if prev_step and prev_step[i] != num:
|
| 11 |
-
print(f"{num:>2} {bar} <- shifted")
|
| 12 |
-
else:
|
| 13 |
-
print(f"{num:>2} {bar}")
|
| 14 |
-
print("-" * 20)
|
| 15 |
-
|
| 16 |
-
for i, step in enumerate(steps):
|
| 17 |
-
print(f"Step {i + 1}: {step}")
|
| 18 |
-
print_step(step,prev)
|
| 19 |
-
prev = step
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|