| 1 | Insert 8 at end | [10, 15, 30, 40, 50, 100, 40, 8] | 7 (new element) | Add 8 at index 7 | Array: [10, 15, 30, 40, 50, 100, 40, 8] |
| 2 | Compare with parent | [10, 15, 30, 40, 50, 100, 40, 8] | 7 (8) vs 3 (40) | 8 < 40 → Swap | Swap index 7 and 3 |
| 3 | After swap | [10, 15, 30, 8, 50, 100, 40, 40] | 3 (8) | Move pointer to 3 | Array: [10, 15, 30, 8, 50, 100, 40, 40] |
| 4 | Compare with parent | [10, 15, 30, 8, 50, 100, 40, 40] | 3 (8) vs 1 (15) | 8 < 15 → Swap | Swap index 3 and 1 |
| 5 | After swap | [10, 8, 30, 15, 50, 100, 40, 40] | 1 (8) | Move pointer to 1 | Array: [10, 8, 30, 15, 50, 100, 40, 40] |
| 6 | Compare with parent | [10, 8, 30, 15, 50, 100, 40, 40] | 1 (8) vs 0 (10) | 8 < 10 → Swap | Swap index 1 and 0 |
| 7 | After swap | [8, 10, 30, 15, 50, 100, 40, 40] | 0 (8) | Move pointer to 0 | Array: [8, 10, 30, 15, 50, 100, 40, 40] |
| 8 | Compare with parent | [8, 10, 30, 15, 50, 100, 40, 40] | 0 (8) has no parent | Stop bubbling up | Heap property restored |