Question: Part 1 Gnome Sort There are many different algorithms available for sorting a list of values. Here's the pseudocode of a sorting algorithm called GnomeSort:
Part 1 Gnome Sort
There are many different algorithms available for sorting a list of values. Here's the pseudocode of a sorting algorithm called GnomeSort: https://en.wikipedia.org/wiki/Gnome_sort
NOTE: PSEUDOCODE ON WIKI PAGE IS IN C# LANGUAGE, MUST USE PYTHON.
gnomeSort(lis):
index = 0
while index is less than len(lis)
if index==0 or the item to the left is less than the item at index:
increment index
else: swap lis[index] with lis[index-1]
decrement index
Write a function called gnomeSort() that performs this algorithm in python. Test that it correctly sorts any given list of random elements.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
