So total number of traversal would be:-T(n) = sigma((2^(logn-h))*h) where h varies from 1 to lognT(n) = n((1/2)+(2/4)+(3/8)+.....+(logn/(2^logn)))T(n) = n*(sigma(x/(2^x))) where x varies from 1 to lognand according to the [sources][1]function in the bracket approaches to 2 at infinity.Hence T(n) ~ O(n)
Green = n/2^1 * 0 (no iterations since no children)red = n/2^2 * 1 (heapify will perform atmost one swap for each red node)blue = n/2^3 * 2 (heapify will perform atmost two swaps for each blue node)purple = n/2^4 * 3 (heapify will perform atmost three swaps for each purple node)