Data Structures

Balanced search tree

Heater

A heater is a data structure that combines features of heaps and binary trees. Nodes are labelled with two kinds of keys:

Heaters are binary trees in the priority keys (blue rectangles), and heaps in the element keys (yellow rectangles):

heater.GIF

Heaters are dynamic structures in that they support efficiently insertion and deletion operations. Insertions are performed in two steps: first, bring the node to be inserted to a leaf position according to the in-order of its priority key (first two images), afterwards perform the necessary rotations to bring it to its correct heap position, as corresponds to the element key (second two images).

insert1.GIF insert2.GIF
insert3.GIF insert4.GIF

Deletions are performed similarly: first, perform the necessary rotations to bring the node to be deleted to a leaf position according to the in-order of its priority key, afterwards eliminate it.

delete1.GIF delete2.GIF
delete3.GIF delete4.GIF

Pablo Jimenez Schlegl
Last modified: Wed Apr 3 17:49:31 MET DST 2002