mirror of
https://github.com/onyx-and-iris/grokking-algorithms.git
synced 2024-11-15 17:30:52 +00:00
rename var
This commit is contained in:
parent
02b8e94dcc
commit
5b6a20dedf
@ -16,15 +16,15 @@ artists = [
|
||||
|
||||
|
||||
def selectionSort(array, size):
|
||||
for ind in range(size):
|
||||
min_index = ind
|
||||
for index in range(size):
|
||||
min_index = index
|
||||
|
||||
for j in range(ind + 1, size):
|
||||
for j in range(index + 1, size):
|
||||
# select the minimum element in every iteration
|
||||
if array[j].count < array[min_index].count:
|
||||
min_index = j
|
||||
# swapping the elements to sort the array
|
||||
(array[ind], array[min_index]) = (array[min_index], array[ind])
|
||||
(array[index], array[min_index]) = (array[min_index], array[index])
|
||||
|
||||
|
||||
selectionSort(artists, len(artists))
|
||||
|
Loading…
Reference in New Issue
Block a user