Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions sorts/gnome_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@

For manual testing run:
python3 gnome_sort.py
Gnome Sort Algorithm implementation in Python.

Gnome sort (also called Stupid Sort) works by comparing the current element
with the previous one. If they are in the wrong order, it swaps them and
moves one step back. Otherwise it moves one step forward.

Time Complexity: O(n^2) in the worst case
Space Complexity: O(1)

Reference: https://en.wikipedia.org/wiki/Gnome_sort
"""


Expand Down