Is the array with values {23, 17, 14, 6, 13, 10, 1, 5, 7, 12} a max-heap? False. Because if you form a tree for 6 which is the 4 the element the children are 8{2i} and 9{2i+1}. But a[9] > a[4]. For max heap you need $a{[}parent(i){]} > a{[}i{]} $ but the array doesn't satisfy the above condition.
No comments:
Post a Comment