WeBeginners-Community / DocBook

Documentations of Html to every open source technologies. It's a low-code repository
30 stars 54 forks source link

Title: Gnome Sort #160

Closed Dharnish38 closed 1 year ago

Dharnish38 commented 1 year ago

Is your feature request related to a problem? Please describe.

Gnome sort is a sorting algorithm based on the concept of a Garden Gnome sorting his flower pots. A garden gnome sorts the flower pots like first he checks a flower pot next to him and previous one , if they are in correct order , he moves one step forward . If not he swaps the pot until it suits in the right order .

Describe the solution you'd like.

Gnome sort is similar to Insertion sort but not exactly the same .

So , there is an array of elements , let's say 5 3 2 4.

-- You are at zeroth position , now move one step forward to your right . -- Check whether this element is greater than or equal to previous element . If yes move right . -- If the current element is smaller than previous element , then swap the elements . -- Repeat these steps till the end of an array . If it reaches the end then the array is sorted.

Describe alternatives you've considered.

N.A

Add any other context or screenshots about the feature request here.

Gnome

I found this example in - https://en.wikipedia.org/wiki/Gnome_sort If you want to visually see how gnome sorting works , then checkout this link - https://www.sortvisualizer.com/gnomesort/

Dharnish38 commented 1 year ago

@Sulagna-Dutta-Roy Please assign this issue to me.