Given a Singly Linked List of size N, your task is to complete the function areIdentical(), which checks whether two linked list are identical or not. Two Linked Lists are identical when they have same data and arrangement of data is also same.
Input: head1:- 1->2->3 head2:- 1->2->3 Output: Identical Input: head1:- 1->3->2 head2:- 1->2->3 Output: Not identical
The function takes two argument as input, the reference pointer to the two heads (head1 & head2) of the two linked list.
There will be T test cases and for each test case the function will be called separately.
For each test the output will be 'Identical' if two list are identical else 'Not identical'.
1 2 3 4 5 6
99 59 42 20
1 2 3 4 5
1 2 3 4 5
Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.