(A) This is min heap. It is obvious looking at tree.
(B) Assuming that we have stored this heap in array structure, Procedure ->
- Search for element 5 using sequencial search in array.
- Swap it with last element in this case 27.
- Bubble down it so that min heap property is satisfied.
(C) Deleting element from mean heap , O(logn) , but for searching in Heap we need O(N)
So, time complexity of sequencial search + Delete = > O(N) + O(logN) = O(N).
We cant use binary search as it is heap.