diff --git a/sorts/gnome_sort.py b/sorts/gnome_sort.py index ea96e0a926a3..4fdd9379fb9d 100644 --- a/sorts/gnome_sort.py +++ b/sorts/gnome_sort.py @@ -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 """