Can you explain this line from the code
-> pq.push({arr[i][0],{i,0}})
Merge k sorted array
Let’s bifurcate it:
We are making pair of { i , 0 } let’s call it -> a
arr[i][0] , let’s call it -> b
Now you will see {b,a} which means we are making pair of b & a and then pushing it in priority queue
So, it means making pair of i & 0 and after that making pair it with arr[i][0] and then pushing it in priority queue.
1 Like
Okay got it thanks!!
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.