All pastes #52772 Raw Edit

Something

public text v1 · immutable
#52772 ·published 2006-05-02 02:26 UTC
rendered paste body
while read in the next block containing 1or more records do
for(i=next record index; i<=last record index in block;i++) do
	while(key[i] < key[parent_of(i)])
	exchange(record[i],record[parent_of(i)];


while(number of records>0)
for(j=0;j<no records per block;j++)
copy the first record in the array to the jth record in the free block
move the record[number of records-1] into the first position in the array
decrement the number of records in array
for(i=0;key[i]>key[l_child(i)])||key[i]>key[r_child(i)]^2; i=smaller_i;
if (key[l_child(i)]<key[r_child(i)]) smaller_i = l_child(i)
else smaller_i=right_child(i)
exhange record[i] with record[smaller_i]