saurabh
BAN USER
Comments (5)
Reputation -20
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
1)Keep start pointer of each array.
2) Create a min-heap of size n (n log(n) ). Each node will contain data and frame number it belongs to and the pointer to the array location it belongs to
3) Fetch root and store it in a result array. Also advance the start-pointer stored in the corresponding node. Fetch the new number and store in heap (log(n))
steps above will be repeated m*n (total number of numbers) times.
Total time : mnlogn(n) + nlog(n) => mnlog(n)
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
linked hashmap ?
- saurabh September 06, 2012