Skip to content

Commit a87e52f

Browse files
Add module docstring to gnome_sort
1 parent 68473af commit a87e52f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sorts/gnome_sort.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
1111
For manual testing run:
1212
python3 gnome_sort.py
13+
Gnome Sort Algorithm implementation in Python.
14+
15+
Gnome sort (also called Stupid Sort) works by comparing the current element
16+
with the previous one. If they are in the wrong order, it swaps them and
17+
moves one step back. Otherwise it moves one step forward.
18+
19+
Time Complexity: O(n^2) in the worst case
20+
Space Complexity: O(1)
21+
22+
Reference: https://en.wikipedia.org/wiki/Gnome_sort
1323
"""
1424

1525

0 commit comments

Comments
 (0)