MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / selectionsort

Function selectionsort

tools/python-3.11.9-amd64/Tools/demo/sortvisu.py:392–403  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

390 array.message("Sorted")
391
392def selectionsort(array):
393 size = array.getsize()
394 array.reset("Selection sort")
395 try:
396 for i in range(size):
397 array.show_partition(i, size)
398 for j in range(i+1, size):
399 if array.compare(i, j) > 0:
400 array.swap(i, j)
401 array.message("Sorted")
402 finally:
403 array.hide_partition()
404
405def bubblesort(array):
406 size = array.getsize()

Callers

nothing calls this directly

Calls 7

show_partitionMethod · 0.80
hide_partitionMethod · 0.80
getsizeMethod · 0.45
resetMethod · 0.45
compareMethod · 0.45
swapMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected