You have n sorted linked lists, each of size n. The linked lists references are stored in an array. What is an efficient algorithm to merge the n linked lists into a single sorted linked list?
Since they are all sorted:
- Incorporate a loop
- Check the first node of all the sorted linked lists and sort them by comparing to each other.
- Proceed to next node and repeat until
null
is hit.
Is this the most efficient way of doing this?