push() expected running time

  • How far to move up?
    • Half of the nodes are leaves, so half of the inserts will only move up one level
    • A quarter of the nodes are one level above the leaves, so one quarter of the inserts will move up two levels
    • One eighth will require moving up 3 levels
    • One sixteenth will require moving up 4 levels
    • Expected running time:
       
      • 1/2 * 1 + 1/4 * 2 + 1/8 * 3 + ... = Sum((1/(2^i))*i = 2