retagged by
19,467 views
76 votes
76 votes

Consider the process of inserting an element into a $Max \: Heap$, where the $Max \: Heap$ is represented by an $array$. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of $comparisons$ performed is:

  1. $\Theta(\log_2n)$

  2. $\Theta(\log_2\log_2n)$

  3. $\Theta(n)$

  4. $\Theta(n\log_2n)$

retagged by

5 Answers

0 votes
0 votes
Time Complexity of Binary Search:Θ(logn)
where n is a number of elements.

Number of the element from root to new leaf is:logn

All the elements in the path from the root to new leaf is sorted then the time complexity to search position for newly inserted element is:Θ(loglogn)
Answer:

Related questions

31 votes
31 votes
8 answers
2
Kathleen asked Sep 21, 2014
25,910 views
A complete $n-ary$ tree is a tree in which each node has $n$ children or no children. Let $I$ be the number of internal nodes and $L$ be the number of leaves in a complet...
17 votes
17 votes
3 answers
3
33 votes
33 votes
4 answers
4