0 votes
in Other by

How to merge two sorted linked lists?

1 Answer

0 votes
by

There are a few ways to merge two sorted linked lists. One way is to use a temporary variable to store the address of the head of the first list and then traverse the lists, inserting each element of the first list into the second list before moving on to the next element in the first list.

Another way is to use a temporary variable to store the address of the head of the second list and then traverse the lists, inserting each element of the first list into the second list before moving on to the next element in the first list.

...