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

Function insertionsort

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

Source from the content-addressed store, hash-verified

378 array.message("Randomized")
379
380def insertionsort(array):
381 size = array.getsize()
382 array.reset("Insertion sort")
383 for i in range(1, size):
384 j = i-1
385 while j >= 0:
386 if array.compare(j, j+1) <= 0:
387 break
388 array.swap(j, j+1)
389 j = j-1
390 array.message("Sorted")
391
392def selectionsort(array):
393 size = array.getsize()

Callers

nothing calls this directly

Calls 5

getsizeMethod · 0.45
resetMethod · 0.45
compareMethod · 0.45
swapMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected