Weight balanced tree left rotation
procedure lrot( var t : tree ); var temp : tree; begin temp := t; t := t^.right; temp^.right := t^.left; t^.left := temp; {*** adjust weight ***} t^.weight := temp^.weight; temp^.weight := wt(temp^.left) + wt(temp^.right); end;
C
source (3414.lrot.c)
Pascal
source (3414.lrot.p)
©
Addison-Wesley
Publishing Co. Inc.