Posted on by Kalkicode
Code Single linked list

Identical Linked Lists

When two linked lists have the same number of nodes and each node has the same values its called the identical linked list. For example.

Example 1
----------
    List  A    5 → 2 → -2 → 1 → 3 → 6 → NULL
    List  B    5 → 2 → -2 → 1 → 3 → 6 → NULL
    -----------------------------------------
    Output : Yes
Example 2
----------
    List  A    1 → 2 → 5 → 4 → 3 → 6 → 7 → NULL
    List  B    1 → 2 → 5 → 4 → 3 → 6 → NULL
    -----------------------------------------
    Output : No

Example 3
----------
    List  A    1 → 2 → 5 → 4 → 3 → 6 → 7 → NULL
    List  B    11 → 2 → 5 → 4 → 3 → 6 → 7 → NULL
    -----------------------------------------
    Output : No

Here given code implementation process.

Time complexity of program is O(n).

Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment