DATA STRUCTURE
Programming and Technical
Programming
Technical
there are two linked lists.those two linked lists meeting at a point.how to finding the meating point
Read Solution (Total 4)
-
- It is not possible to find .., as there do not exist such point cause they do not resemble physical contact and they contain only address to link between two nodes
- 9 years agoHelpfull: Yes(5) No(2)
- http://www.geeksforgeeks.org/write-a-function-to-get-the-intersection-point-of-two-linked-lists/
- 9 years agoHelpfull: Yes(3) No(0)
- Question is vague.
- 9 years agoHelpfull: Yes(1) No(1)
- 1) Get count of the nodes in the first list, let count be c1.
2) Get count of the nodes in the second list, let count be c2.
3) Get the difference of counts d = abs(c1 – c2)
4) Now traverse the bigger list from the first node till d nodes so that from here onwards both the lists have equal no of nodes.
5) Then we can traverse both the lists in parallel till we come across a common node. (Note that getting a common node is done by comparing the address of the nodes) - 5 years agoHelpfull: Yes(0) No(0)
DATA STRUCTURE Other Question