Data Structures19 sections · 729 units
Open in CourseQuiz: K-Way Merge
Complexity analysis
Check Your Understanding
When merging k sorted lists with n total elements, why is the heap approach O(n log k)?
- A.Because we sort n elements k times
- B.Because the heap has at most k elements, and we do n insertions/extractions
- C.Because we compare each element to k others
- D.Because we merge lists in pairs log(k) times