Jump to content

Sorting algorithms/Heapsort: Difference between revisions

added FunL
(added FunL)
(added FunL)
Line 923:
while end > 0
a(end), a(0) = a(0), a(end)
endsiftDown( a, 0, --end )
siftDown( a, 0, end )
 
def heapify( a ) =
startfor =i <- (a.length() - 2)\2..0 by -1
siftDown( a, 0i, enda.length() - 1 )
 
while start >= 0
siftDown( a, start, a.length() - 1 )
start--
 
def siftDown( a, start, end ) =
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.