Table of content

Gnome Sort in kotlin

The Gnome Sort is extremely simple and is very similar to the principle behind the Insertion Sort.

The Gnome Sort is yet another comparison and exchange sort which has elements that are similar to the Bubble Sort. If you haven’t read up on the Bubble Sort, be sure to do that before reading this article as it may help with your understanding.

  • Data set - the array or list of items that are to be sorted.
  • n - the number of elements in the data set.
  • Bubble - perform a Bubble Sort-like shuffle of an item in a given direction.

Shell Sort

Gnome Sort Algorithm

The first principle to bear in mind when doing a Gnome Sort is that as the algorithm progresses, all items to the left of the current item are always in order. Each iteration of the algorithm moves the current item to the correct spot with respect to the previously sorte