Hướng dẫn merge two linked lists python - hợp nhất hai danh sách được liên kết bằng python

Viết một hàm Sắp xếp [] có hai danh sách, mỗi danh sách được sắp xếp theo thứ tự tăng lên và hợp nhất hai người lại với nhau thành một danh sách theo thứ tự tăng lên. SortedMerge [] sẽ trả về danh sách mới. Danh sách mới nên được thực hiện bằng cách ghép các nút của hai danh sách đầu tiên.

Ví dụ: nếu danh sách được liên kết đầu tiên A là 5-> 10-> 15 và danh sách được liên kết khác B là 2-> 3-> 20, thì Sett 3-> 5-> 10-> 15-> 20.

Có nhiều trường hợp để giải quyết: 'A' hoặc 'B' có thể trống, trong quá trình xử lý 'A' hoặc 'B' có thể hết trước, và cuối cùng, có vấn đề bắt đầu danh sách kết quả trống và xây dựng Nó lên trong khi đi qua 'A' và 'B'.

Phương pháp 1 [sử dụng các nút giả] & nbsp; Chiến lược ở đây sử dụng nút giả tạm thời làm bắt đầu danh sách kết quả. Đuôi con trỏ luôn chỉ vào nút cuối cùng trong danh sách kết quả, vì vậy việc nối thêm các nút mới rất dễ dàng. & NBSP; 
The strategy here uses a temporary dummy node as the start of the result list. The pointer Tail always points to the last node in the result list, so appending new nodes is easy. 

Nút giả cung cấp cho đuôi một cái gì đó để chỉ vào ban đầu khi danh sách kết quả trống. Nút giả này là hiệu quả, vì nó chỉ là tạm thời và nó được phân bổ trong ngăn xếp. Vòng lặp tiến hành, loại bỏ một nút khỏi ‘A, hoặc‘ B, và thêm nó vào đuôi. Khi & nbsp;

Chúng tôi đã hoàn thành, kết quả là trong dummy.next. & Nbsp;

Hình ảnh dưới đây là một hoạt động khô của phương pháp trên:

Dưới đây là việc thực hiện phương pháp trên: & nbsp;

C++

#include

using namespace std;

class Node 

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
8

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
0

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
1

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
6

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
8

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0 #include 1

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0

#include 4#include 5 #include 6

#include 4

#include 9using0

#include 9using2using3

#include 4using5

#include 4using7 #include 5 using9

#include 4

#include 9namespace3

#include 9using2using3

#include 4using5

#include 4#include 5 std;1

#include 9std;3

#include 4using7

#include 9std;7

#include 4std;9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3class4

using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9 class7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0Node 0

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0Node 2Node 3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0Node 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0Node 7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0Node 9

using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9 2
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
078 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
01

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
03

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
05

using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
08

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
12

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
16
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
17using3

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
20

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using5

using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
25

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
28

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
30

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
32

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
34

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
36

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
38

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
40

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
42

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
44

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
46

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
48
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
49using3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
52

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
55

using5

C

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
57

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
58

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
59

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
61

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
65

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
68

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
69

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
71
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
73
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
75

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
77
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
79
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
81

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
85

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
88

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
90

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
93

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
98

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
02

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4using7 #include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
11

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
15

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
23

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
25

#include 4using7

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
29

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
31

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
36

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
71
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
73
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
43

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
47

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0Node 2
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
50

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
52

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
54

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
56

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
59
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
61
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
63

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
67

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
71
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
7272.

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
79

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
81

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
83

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
86
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
88

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
92

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
96
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
98
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
99

#include 4#include 01

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4 #include 06

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60 #include 10

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60 #include 13

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60 #include 16

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 18

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 20

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 22

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 24

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 26

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 28

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 30

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
96
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
49#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 37

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3 #include 40

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

Java

#include 42 #include 43

class Node 

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
65

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 51

____10#include 53

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4 #include 55

#include 56#include 57#include 58#include 59

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

class #include 62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 64

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9 #include 67

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

____10#include 5 #include 71#include 58#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4#include 77

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4#include 85

#include 4#include 0 #include 88#include 58#include 73

#include 9#include 92

#include 4#include 94

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9 #include 99

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 85

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0 using05#include 58#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4using11

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
17#include 35

#include 4#include 92

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using19

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1 using22
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9 using24

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

____10using278 using29

____10using318 using29

____10using358 #include 53using38using39

____10using358 #include 53using444using39

____10using358 #include 53using50using39

____10using538 #include 53using56using39

____10using538 #include 53using62using39

____10using538 #include 53using68using39

____10using718 using73

using74using75

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using77

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

class using81

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

using83

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

____10using868 #include 53using89#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using92

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69using96using97

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4#include 5namespace022358#include 73

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9namespace08

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4#include 5namespace16#include 58#include 73

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9namespace22

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4#include 5namespace30

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9namespace22

#include 9namespace36

#include 4using5

#include 4using7

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9namespace08

#include 9namespace46

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4namespace50

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3 namespace55

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

Python3

class namespace59

____10namespace61 namespace62namespace63namespace64

#include 4namespace63namespace67namespace68 namespace69

#include 4namespace63namespace72 ____573 namespace68 namespace75

class namespace77

____10namespace61 namespace62namespace63namespace82

#include 4namespace63namespace85namespace68 namespace75

____10namespace61

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
86namespace63namespace82

#include 4namespace94namespace68 namespace63namespace97

#include 4#include 0 std;00

#include 9std;02std;03namespace68

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
17#include 73

#include 9namespace94namespace68 std;10namespace73

____10namespace61 std;14namespace63std;16

#include 4std;18namespace68 std;20

#include 4#include 5 namespace63namespace85std;25 namespace75

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 9namespace63namespace85namespace68 std;32

#include 9class3

#include 4std;36namespace68 namespace63namespace97

#include 4#include 0 std;42namespace73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 9std;36namespace68 std;42namespace73

#include 4std;42namespace73 namespace68 std;32

namespace61 std;56

____10std;58namespace68 #include 53using89#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0std;64namespace68 std;66

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0 std;69
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 4#include 5 std;73std;25 namespace75

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 9std;78namespace73 namespace68 std;81

#include 9using2

#include 4#include 5 std;86std;25 namespace75

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 9std;78namespace73 namespace68 std;94

#include 9using2

#include 4#include 5 std;99namespace68 class01

#include 9std;78namespace73 namespace68 std;94

#include 4#include 5 std;99namespace68 class01

#include 4using7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 9std;78namespace73 namespace68 std;81

#include 9std;86namespace68 class23namespace73

#include 4std;64namespace68 std;78namespace73

____10class3 class32namespace73

class34namespace68 class36

class37namespace68 class36

class40using38#include 73

class40using44#include 73

class40using50#include 73

class49using56#include 73

class49using62#include 73

class49using68#include 73

class58namespace68 class60

std;02

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69class63#include 73

class65

C#

using class67

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0____11 class Node 

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
5

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1 class80

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1 #include 53
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4 class85

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9class89

#include 9#include 57#include 58

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0____11 class #include 62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0

#include 4#include 64

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9 #include 67

#include 4

#include 9#include 5 #include 71#include 58using97

#include 9

Node 19Node 20

#include 9using5

#include 9using7

#include 9

Node 19Node 28

Node 19#include 0 #include 88#include 58using97

Node 34Node 35

Node 19Node 37

#include 9using5

#include 4using5

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9 Node 44

#include 4

#include 9Node 28

#include 9#include 0 using05#include 58using97

#include 9

Node 56Node 57

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
17Node 59

Node 19Node 35

#include 9using5

#include 9Node 65

#include 4using5

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1 using22
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9 Node 72

#include 4

#include 9using278 Node 78

#include 9using318 Node 78

#include 9using358 Node 86

#include 9using358 Node 90

#include 9using358 Node 94

#include 9using538 Node 98

#include 9using538 02

#include 9using538 06

#include 9using718 using73

1112

#include 914

#include 4using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0____11 class 22

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0____11 27

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0

#include 4using868 33

#include 435

#include 4#include 0

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69using96using97

#include 4

#include 9#include 5namespace02#include 58using97

#include 9

Node 1951

Node 19using2using3

#include 9using5

#include 9#include 5namespace16#include 58using97

#include 9

Node 1965

Node 19using2using3

#include 9using5

#include 9#include 573

#include 9

Node 1965

Node 1979

#include 9using5

#include 9using7

#include 9

Node 1951

Node 1989

#include 9using5

#include 993

#include 4using5

#include 4class3 98

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using5

using5

JavaScript

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
002

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
003

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
006

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
010
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
011

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
010
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
014#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
020

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
022

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
010
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
026#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
030

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

Các

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
010
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
043

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
051
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
010
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
053

#include 4#include 0 #include 88#include 58#include 73

#include 9#include 92

#include 4#include 94

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 99

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
051
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
010
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
053

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0 using05#include 58#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
080
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
17#include 35

#include 4#include 92

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
088
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
089#include 35

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
093
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
094

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

____10

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0978
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
099

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
101

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69using96#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4#include 5namespace02#include 58#include 73

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9namespace08

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4#include 5namespace16#include 58#include 73

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9namespace22

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4#include 5namespace30

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9namespace22

#include 9namespace36

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4using7

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9namespace08

#include 9namespace46

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4namespace50

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3 namespace55

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1668
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
168

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1698
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
168

using358

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
174

using358

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
177

using358

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
180

using538

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
183

using538

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
186

using538

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
189

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
190

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
191using75

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
088
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
194#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
196

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
197

Đầu ra: & nbsp; 

Merged Linked List is: 
2 3 5 10 15 20

Phương pháp 2 [sử dụng các tài liệu tham khảo cục bộ] & nbsp; giải pháp này có cấu trúc rất giống với ở trên, nhưng nó tránh được bằng cách sử dụng một nút giả. Thay vào đó, nó duy trì một con trỏ cấu trúc ** con trỏ, LastPtrref, luôn chỉ vào con trỏ cuối cùng của danh sách kết quả. Điều này giải quyết trường hợp tương tự mà nút giả đã làm - xử lý danh sách kết quả khi nó trống. Nếu bạn đang cố gắng xây dựng một danh sách ở đuôi của nó, có thể sử dụng nút giả hoặc nút cấu trúc ** Tài liệu tham khảo có thể được sử dụng [xem Phần 1 để biết chi tiết]. & NBSP; 
This solution is structurally very similar to the above, but it avoids using a dummy node. Instead, it maintains a struct node** pointer, lastPtrRef, that always points to the last pointer of the result list. This solves the same case that the dummy node did — dealing with the result list when it is empty. If you are trying to build up a list at its tail, either the dummy node or the struct node** “reference” strategy can be used [see Section 1 for details]. 

C++14

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
198

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
201

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
203

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
206

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
209

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
211

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4using7 #include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
220

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
222

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
23

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
232

#include 4using7

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
236

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
238

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
243

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

C

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
77
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
79
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
81

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
201

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
203

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
206

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
209

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
211

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4using7 #include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
220

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
222

#include 4#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
23

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
23

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
232

#include 4using7

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
236

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
238

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
243

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

C

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
299

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
302#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
306

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
77
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
79
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
81

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
201

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
318

#include 4#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
23

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
236

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
331

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
243

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
341

#include 4using7

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
345

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
347

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
243

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

Python3

C

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
77
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
79
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
81

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
201

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
310namespace82

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
203

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 9using2using3

Java

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
310
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

#include 9using2using3

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
314#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
404

#include 4using7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
407

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
409

#include 4using7 #include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
327#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
418

C#

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
299

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
302#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
306

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
206

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
201

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
318

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
236

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
331

#include 4#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
23

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
243

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
341

#include 4using7

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
345

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
347

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
243

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

C

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
002

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
77
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
79
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
81

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
477#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
480

#include 0

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
93

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
201

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
203

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using2
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 9using2

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
331

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using2
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 5
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
339

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
341

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
345

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
347

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
243

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
197

Phương pháp 3 [sử dụng đệ quy] & nbsp; hợp nhất là một trong những vấn đề đệ quy tốt đẹp trong đó mã giải pháp đệ quy sạch hơn nhiều so với mã lặp. Tuy nhiên, bạn có thể muốn sử dụng phiên bản đệ quy cho mã sản xuất, bởi vì nó sẽ sử dụng không gian ngăn xếp tỷ lệ với độ dài của danh sách. & NBSP; & NBSP; 
Merge is one of those nice recursive problems where the recursive solution code is much cleaner than the iterative code. You probably wouldn’t want to use the recursive version for production code, however, because it will use stack space which is proportional to the length of the lists.  

C++

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
1

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
540

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 5 #include 6

#include 4class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
546

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using7 #include 5 using9

#include 4class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
553

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 5 std;1

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
560

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
562

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
570

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
572

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
418

using5

C

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
77
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
79
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
584

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
201

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586#include 5 #include 6

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
592class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
594

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586using7 #include 5
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
598

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
592class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
601

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586#include 5 std;1

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
592
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
608

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
592
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
610

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586using

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
592
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
618

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
592
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
620

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
586class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
243

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

Java

class

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
628

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0____11
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
632

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
637#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
639class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
641

Các

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
651

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
655

#include 9class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
648

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4using

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
666

#include 9class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
641

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

Python3

class namespace59

____10namespace61 namespace62namespace63namespace64

#include 4namespace63namespace67namespace68 namespace69

#include 4namespace63namespace72 ____573 namespace68 namespace75

class namespace77

____10namespace61 namespace62namespace63namespace82

#include 4namespace63namespace85namespace68 namespace75

____10namespace61

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
86namespace63namespace82

#include 4namespace94namespace68 namespace63namespace97

#include 4#include 0

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
717

#include 9std;02std;03namespace68

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
722#include 73

#include 9namespace94namespace68 std;10namespace73

____10namespace61

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
731namespace63
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
733

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
735namespace68
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
737

#include 4#include 5 namespace63namespace85std;25 namespace75

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 9namespace63namespace85namespace68

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
749

#include 9class3

#include 4std;36namespace68 namespace63namespace97

#include 4#include 0 std;42namespace73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 9std;36namespace68 std;42namespace73

#include 4std;42namespace73 namespace68

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
749

namespace61

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
773

____10namespace94namespace68 namespace75

____10#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
780std;25 namespace75
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 4class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
786

____10#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
789std;25 namespace75
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 4class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
795

____10#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
798namespace68
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
800

#include 4namespace94namespace68

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
795

#include 4std;10namespace73 namespace68

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
809namespace73
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
811

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using7
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

#include 4namespace94namespace68

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
786

#include 4std;10namespace73 namespace68

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
823namespace73#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
828

#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
830namespace68namespace68
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
833
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
2

____10

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
836namespace68 class36

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
840using44#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
840using68#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
840
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
849#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
840
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
853#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
840
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
857#include 73

____10

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
860namespace68 class36

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
864using38#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
864using50#include 73

____10

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
864
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
873#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
864
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
877#include 73

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
864
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
881#include 73

____10

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
884namespace68 class36

____10

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
888namespace68
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
890

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0std;02
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
894
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
895namespace68
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
897

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
899

C#

using class67

class

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
903

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
905

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

____10#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
637#include 58#include 73

#include 4class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
641

____10#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
644#include 58using97

#include 4class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
648

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 5
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
651

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
929

#include 4class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
648

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0using7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
940

#include 4class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
641

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

____10#include 5
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
644#include 58using97

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
002

#include 4class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
648

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 5
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
651

JavaScript

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0____101093
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
951

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
637#include 58#include 73

#include 9class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
641

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
655

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
637#include 58#include 73

#include 9class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
641

#include 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
666

JavaScript

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
197

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0____101093
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
951
Time Complexity:  Since we are traversing through the two lists fully. So, the time complexity is O[m+n] where m and n are the lengths of the two lists to be merged. 

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
637#include 58#include 73

#include 9class3

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
641reversing both the given lists and after reversing, traversing both the lists till the end and then comparing the nodes of both the lists and inserting the node with a larger value at the beginning of the result list. And in this way we will get the resulting list in increasing order.

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
644#include 58#include 73

#include 9class3
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
648

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
990

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
991

#include 4#include 5

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
970

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
977 ____47
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

& nbsp; độ phức tạp về thời gian: & nbsp; vì chúng tôi đang đi qua hai danh sách đầy đủ. Vì vậy, độ phức tạp về thời gian là O [M+N] trong đó M và N là độ dài của hai danh sách sẽ được hợp nhất. & NBSP;

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
001

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
002

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

Phương pháp 4 [đảo ngược danh sách]

Ý tưởng này bao gồm lần đầu tiên đảo ngược cả danh sách đã cho và sau khi đảo ngược, đi qua cả hai danh sách cho đến cuối và sau đó so sánh các nút của cả hai danh sách và chèn nút có giá trị lớn hơn ở đầu danh sách kết quả. Và theo cách này, chúng tôi sẽ nhận được danh sách kết quả theo thứ tự tăng lên.

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
011

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
013

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
015

Dưới đây là việc thực hiện giải pháp trên.

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
020

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

C

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
025

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
027

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
029

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
992
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
994

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
997

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
037

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
039

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
041

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
043

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
68

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
050

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
052

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
054

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
056

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 5
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
006

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
037

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
039

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
041

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
043

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4class3

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
009

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
050

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
052

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
054

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
056

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
018

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
023

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
032

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
96
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
102
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
103

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
105

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
035

#include 4using7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
114
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
72
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
74
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
118

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
120

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
122

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
063

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
076

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
009

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
134

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
136

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
138

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
140

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
142

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
144

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
146

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
96
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
150#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
153

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
96
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
157#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
160

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
162

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
96
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
69
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
166#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 37

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
86
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
094

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

C++

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
174

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
098

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
109
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
111

#include 4

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
977 ____47
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

& nbsp; độ phức tạp về thời gian: & nbsp; vì chúng tôi đang đi qua hai danh sách đầy đủ. Vì vậy, độ phức tạp về thời gian là O [M+N] trong đó M và N là độ dài của hai danh sách sẽ được hợp nhất. & NBSP;

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
69

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
002

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

Phương pháp 4 [đảo ngược danh sách]

Ý tưởng này bao gồm lần đầu tiên đảo ngược cả danh sách đã cho và sau khi đảo ngược, đi qua cả hai danh sách cho đến cuối và sau đó so sánh các nút của cả hai danh sách và chèn nút có giá trị lớn hơn ở đầu danh sách kết quả. Và theo cách này, chúng tôi sẽ nhận được danh sách kết quả theo thứ tự tăng lên.

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
011

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
013

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
015

Dưới đây là việc thực hiện giải pháp trên.

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
020

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
023

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
025

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
027

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
029

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
992
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
994

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
997

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
037

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
039

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
041

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
043

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
68

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
050

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
052

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
054

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
056

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
063

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
037

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
039

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
041

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
043

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
076

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
050

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
052

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
054

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
056

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
009

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
86
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
094

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
098

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
285
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
17
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
105

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
109
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
111

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

____10

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
2988
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
300

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
120

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
122

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
125

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4 #include 06

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60 #include 10

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
134

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
136

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
138

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
140

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
142

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
144

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
146

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
48
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
150
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
153

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
48
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
157
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
160

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
162

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
48
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
166
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 37

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3 #include 40

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

Java

#include 42 #include 43

class

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
903

using22 class

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
994

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
997

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 51

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
69

using22

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
367

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

____10#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
371#include 58#include 73

#include 4class3

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
009

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
378

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
380

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
382#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
018

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

using22

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
390

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
023

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
025

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
397#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
401

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
404#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
406#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

#include 4#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
411

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
413

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
415

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
041

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
043

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4using7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
426

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
428

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
054

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
056

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
404#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
413

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
415

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
041

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
043

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
454#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
426

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
428

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
054

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
056

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
009

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
86
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
094

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
098

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
481
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
17#include 35

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
485

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
105

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
109
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
111

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
499

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
501#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
125

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4 #include 06

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
60 #include 10

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
514#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
518using38#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
522using44#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
526using50#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
530
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
853#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
534using56#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
538using62#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
542using68#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
546
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
150#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
153

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
546
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
157#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
160

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
162

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
153

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 37

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

C#

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3 #include 40

Java

#include 42 #include 43

class

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
903

using22 class

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
994

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
997

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
69

using22

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
367

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

____10#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
371#include 58#include 73

#include 4class3

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
009

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
378

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
380

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
018

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
018

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

using22

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
390

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
023

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
025

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
397#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
401

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
404#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
406#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

#include 4#include 5

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
411

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
413

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
415

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
041

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
043

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

#include 4using7

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
426

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
428

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
054

#include 9

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
056

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
404#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
413

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
415

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
041

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
043

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
454#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
426

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
428

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
054

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
056

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
009

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

using22

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
473

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
477#include 58
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
311

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
700
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
17#include 35

#include 4

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
485

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

using22

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
490
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
4
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
111

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

____10

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
4958 9

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
499

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
501#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0class3
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
125

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
1 using22
1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
9
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
730

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
62

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
514#include 58
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
05

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
737

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
739

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
741

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
743

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
745

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
747

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
749

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
751
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
150#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
153

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
751
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
157#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
160

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
162

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
751
List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
166#include 35

1] Initialize result list as empty: head = NULL.
2] Let 'a' and 'b' be the heads of first and second list respectively.
3] Reverse both the lists.
4] While [a != NULL and b != NULL]
    a] Find the larger of two [Current 'a' and 'b']
    b] Insert the larger value of node at the front of result list.
    c] Move ahead in the list of larger node. 
5] If 'b' becomes NULL before 'a', insert all nodes of 'a' 
   into result list at the beginning.
6] If 'a' becomes NULL before 'b', insert all nodes of 'b' 
   into result list at the beginning.  
0#include 37

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 
07

Output:

List A before merge: 
5 10 15 40 
List B before merge: 
2 3 20 
Merged Linked List is: 
2 3 5 10 15 20 40 

Độ phức tạp về thời gian: & nbsp; Vì chúng tôi đang đi qua hai danh sách đầy đủ. Vì vậy, độ phức tạp về thời gian là O [M+N] trong đó M và N là độ dài của hai danh sách sẽ được hợp nhất. & NBSP; Since we are traversing through the two lists fully. So, the time complexity is O[m+n] where m and n are the lengths of the two lists to be merged. 

Phương pháp này được đóng góp bởi Mehul Mathur [Mathurmehul01]. & NBSP;Mehul Mathur[mathurmehul01]

Ý tưởng này tương tự như bài viết này.

Vui lòng tham khảo bài đăng dưới đây để triển khai đơn giản hơn: & nbsp; hợp nhất hai danh sách được sắp xếp [tại chỗ] Nguồn: //csl Library.stanford.edu/105/linkedlistproblems.pdflease Viết nhận xét Nếu bạn tìm thấy mã trên/thuật toán trên Những cách tốt hơn để giải quyết vấn đề tương tự.
Merge two sorted lists [in-place]
Source: //cslibrary.stanford.edu/105/LinkedListProblems.pdf
Please write comments if you find the above code/algorithm incorrect, or find better ways to solve the same problem.


Làm thế nào để bạn hợp nhất một danh sách được liên kết?

Thuật toán cho Sắp xếp hợp nhất Nếu: Danh sách chứa một hoặc ít phần tử hơn, trả về cùng một danh sách. Khác: Chia danh sách thành một nửa bằng cách sử dụng chức năng chia tách. Sắp xếp: Sắp xếp hai nửa của danh sách. Cuối cùng, hợp nhất các danh sách được sắp xếp.If: The list contains one or fewer elements, return the same list. Else: Divide the list into halves using the splitting function. Sort: Sort ​the two halves of the list. At the end, merge the sorted lists.

Làm thế nào để bạn hợp nhất hai danh sách trong Python?

SortedMerge [] sẽ trả về danh sách mới.Danh sách mới nên được thực hiện bằng cách ghép các nút của hai danh sách đầu tiên.Ví dụ: nếu danh sách được liên kết đầu tiên A là 5-> 10-> 15 và danh sách được liên kết khác B là 2-> 3-> 20, thì Sett3-> 5-> 10-> 15-> 20.. The new list should be made by splicing together the nodes of the first two lists. For example if the first linked list a is 5->10->15 and the other linked list b is 2->3->20, then SortedMerge[] should return a pointer to the head node of the merged list 2->3->5->10->15->20.

Thuật toán nào phù hợp nhất để hợp nhất hai danh sách được liên kết?

Phương pháp: Sử dụng đệ quy trong phương pháp trên, chúng tôi đã thử cách tiếp cận lặp bằng cách sử dụng các nút giả.Bây giờ chúng tôi sẽ thử kỹ thuật đệ quy để hợp nhất hai danh sách liên kết được sắp xếp.Có ít mã hơn so với cách tiếp cận lặp vì nó sử dụng ngăn xếp cuộc gọi để tự gọi để làm việc với các đối số được thông qua.Using Recursion In the above method we tried the iterative approach using dummy nodes. Now we will try the recursion technique to merge two sorted LinkedLists. There is less code than with the iterative approach as it uses the call stack to call itself to work with passed arguments.

Làm thế nào để tôi kết hợp hai danh sách liên kết gấp đôi?

Cách tiếp cận: Sau đây là các bước:..
Nếu đầu1 == null, hãy trả lại đầu 2 ..
Nếu head2 == null, return head1 ..
Đặt Last1 và Last2 lần lượt là nút cuối cùng của hai danh sách.....
Nhận con trỏ đến nút sẽ là nút cuối cùng của danh sách cuối cùng.....
Cập nhật Last 1 ..

Bài Viết Liên Quan

Chủ Đề