From a87e52f26312f0b78e86fef54f770ae8dcd7c515 Mon Sep 17 00:00:00 2001 From: Rohit Date: Sun, 15 Mar 2026 01:57:37 +0530 Subject: [PATCH 1/3] Add module docstring to gnome_sort --- sorts/gnome_sort.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 """ From e06c0d2539229a2481ccc6ce3188b4deec7f630a Mon Sep 17 00:00:00 2001 From: frecklysledge0 <135573015+frecklysledge0@users.noreply.github.com> Date: Sun, 15 Mar 2026 02:10:13 +0530 Subject: [PATCH 2/3] Update documentation for gnome_sort.py --- sorts/gnome_sort.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sorts/gnome_sort.py b/sorts/gnome_sort.py index 4fdd9379fb9d..1df7283a8275 100644 --- a/sorts/gnome_sort.py +++ b/sorts/gnome_sort.py @@ -9,6 +9,7 @@ python3 -m doctest -v gnome_sort.py For manual testing run: + python3 gnome_sort.py Gnome Sort Algorithm implementation in Python. From 86d13d7b13ebfab3f2fe1a28a98f15fb4417fac9 Mon Sep 17 00:00:00 2001 From: frecklysledge0 <135573015+frecklysledge0@users.noreply.github.com> Date: Sun, 15 Mar 2026 02:11:39 +0530 Subject: [PATCH 3/3] Fix formatting by removing blank line Removed extra blank line in gnome_sort.py --- sorts/gnome_sort.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sorts/gnome_sort.py b/sorts/gnome_sort.py index 1df7283a8275..4fdd9379fb9d 100644 --- a/sorts/gnome_sort.py +++ b/sorts/gnome_sort.py @@ -9,7 +9,6 @@ python3 -m doctest -v gnome_sort.py For manual testing run: - python3 gnome_sort.py Gnome Sort Algorithm implementation in Python.