Heap sort , about the implementation of method involving range
The signature for range
is range(start, stop[, step])
.
The range
function in range(n, -1, -1)
accept 3 argument:
'n' as the start index of the range object
the first '-1' as the end index of the range object
the second '-1' as the move step of the range object
So range(n, -1, -1)
basic means construct a sequence of [n, n-1, ..., 1, 0].
For more you can refer to Python Doc