[Home]
[Chapter]
[Contents]
[Previous Algorithm]
[Next Algorithm]


Leftist trees insertion


procedure insert ( new : tree; var pq : tree ); begin if pq = nil then pq := new else if pq^.k > new^.k then begin insert( new, pq^.right ); fixdist( pq ) end else begin new^.left := pq; pq := new end end;

C source (516.ins.c) Pascal source (516.ins.p)



© Addison-Wesley Publishing Co. Inc.