Paste Search Dynamic
Recent pastes
selection sort
  1. def selection_sort(sort_list):
  2. for i in range(len(sort_list)):
  3. smallest_element = min(sort_list[i:])
  4. index_of_smallest = sort_list.index(smallest_element)
  5. sort_list[i], sort_list[index_of_smallest] =
  6. sort_list[index_of_smallest], sort_list[i]
  7. print('ITERATION ', i + 1,':', sort_list)
Parsed in 0.002 seconds