Merge 'k' sorted arrays, each array may have max 'n' elements
Anonymous
Complexity for 1st solution is wrong: Let's assume that each array has n elements. When we doing first merge, we do O(n + n )operation. Second merge requires O(n+n+n) operations, Third O(3*n + n) operation. 1. 2*n 2. 3*n 3. 4*n .... k-1. k*n So the total time wil be O(n*k*k)
Check out your Company Bowl for anonymous work chats.