Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us
Hide Buttons

Find Intersection Point in Two Linked List

Objec­tive: Given Two linked list, check whether both list inter­sect each other, if yes then find the start­ing node of the intersection.

Inter­sec­tion point means end of one linked list is linked with some node in another linked list and it forms a Y shape.

Input: Two Linked List

Out­put: Inter­sec­tion Node or point


Find Intersection Point in Two Linked List

Find Inter­sec­tion Point in Two Linked List


  • Find the length of both the linked lists say : a_len and b_len
  • Find the len­Diff = (a_len ~ b_len)
  • Tra­verse the longer linked list by lenDiff
  • Now tra­verse both the lists at the same time
  • Check whether nodes are same, if yes then we have found the inter­sec­tion point
  • If we reach the end of the link lists then there is no inter­sec­tion point.

Trick Solu­tion:

 Time Com­plex­ity : O(n) , Space Com­plex­ity : O(1)
Com­plete Code:


List A :
List B :
Intersection found at 30

You may also like...