Heap Growth Example

We will start with an empty heap and add the letters F, E, D, C, B, and A in that order.

Create an empty heap with an empty root node. One empty node
Insert the letter F. One node with F
Append an empty node. Two nodes, one empty
Insert the letter E. Two nodes: F, E
Bubble up. Exchange E and F. Two nodes: E, F
Append an empty node. Three nodes, one empty
Insert the letter D. Three nodes, E, F, D
Bubble up. Exchange D and E. Three nodes: D, F, E
Append an empty node. Four nodes, one empty
Insert the letter C. Four nodes: D, F, E, C
Bubble up. Exchange C and F. Four nodes: D, C, E, F
Bubble up. Exchange C and D. Four nodes: C, D, E, F
Append an empty node. Five nodes, one empty
Insert the letter B. Five nodes: C, D, E, F, B
Bubble up. Exchange B and D. Five nodes: C, B, E, F, D
Bubble up. Exchange B and C. Five nodes: B, C, E, F, D
Append an empty node. Six nodes, one empty
Insert the letter A. Six nodes: B, C, E, F, D, A
Bubble up. Exchange A and E. Six nodes: B, C, A, F, D, E
Bubble up. Exchange A and B. Six nodes: A, C, B, F, D, E