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 4 weeks 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 4 weeks 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).