The worst case analysis for a naïve merge is given as?

Category: QuestionsThe worst case analysis for a naïve merge is given as?
Editor">Editor Staff asked 5 months ago

The worst case analysis for a naïve merge is given as?
 
(a) O(N)
 
(b) O( log N)
 
(c) O( N log N)
 
(d) O(N^2)
 
This interesting question is from Heap in portion Heap of Data Structures & Algorithms I
 
The question was posed to me during an online interview.

1 Answers
Editor">Editor Staff answered 5 months ago

Right choice is (a) O(N)
 
To explain: The worst-case analysis for the naïve merge is an insertion in a right heavy tree. So, insertion takes O(N).


Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17
Articles: 40702