retagged by
14,324 views
23 votes
23 votes

Consider a binary max-heap implemented using an array.
Which one of the following array represents a binary max-heap?

  1. $\left\{25,12,16,13,10,8,14\right\}$    
  2. $\left\{25,14,13,16,10,8,12\right\}$
  3. $\left\{25,14,16,13,10,8,12\right\}$
  4. $\left\{25,14,12,13,10,8,16\right\}$
retagged by

3 Answers

Best answer
15 votes
15 votes

Answer : (C)

The binary max-Heap looks like this :

Max-heap

 

edited by
18 votes
18 votes
Taking the given array as level order traversal, we can build binary tree.

(A)  13 comes as child of 12, which is not allowed in a binary max-heap

(B) 16 comes as child of 14 violating max-heap property

(C) is a valid binary max-heap as all children are smaller than their parent

(D) 16 comes as child of 12, violating max-heap property
Answer:

Related questions

9.0k
views
3 answers
24 votes
go_editor asked Apr 23, 2016
8,968 views
Consider a binary max-heap implemented using an array.What is the content of the array after two delete operations on $\left\{25,14,16,13,10,8,12\right\}$\left\{14,13,12,10, ... $\left\{14,13,12,8,10\right\}$
44.4k
views
5 answers
40 votes
Kathleen asked Sep 22, 2014
44,354 views
What is the maximum height of any AVL-tree with $7$ nodes? Assume that the height of a tree with a single node is $0$.$2$3$4$5$
7.6k
views
2 answers
33 votes
Kathleen asked Sep 22, 2014
7,573 views
The keys $12, 18, 13, 2, 3, 23, 5$ and $15$ are inserted into an initially empty hash table of length $10$ using open addressing with hash function $h(k) = k \mod 10$ and ...
5.0k
views
1 answers
5 votes
Kathleen asked Sep 22, 2014
5,041 views
Consider the following statements about the cyclomatic complexity of the control flow graph of a program module. Which of these are TRUE? The cyclomatic complexity of a ... path coverage testing.I and IIII and IIII and IIII, II and III