Log In
0 votes

Suppose there are two singly linked lists both of which intersect at some point
and become a single linked list. The head or start pointers of both the lists are known, but
the intersecting node is not known. Also, the number of nodes in each of the lists before
they intersect is unknown and may be different in each list. List1 may have n nodes before
it reaches the intersection point, and List2 might have m nodes before it reaches the
intersection point where m and n may be m = n,m < n or m > n. Give an algorithm for
finding the merging point. And find the time complexity and space complexity also.


in DS 322 views
can we reduce the time complexity by using hashing table?

Please log in or register to answer this question.

Related questions

1 vote
2 answers
1) What is the algorithm for reversing the singly linked list? 2) How palindrome could be made with the help of this algo ?
asked Sep 12, 2017 in Algorithms srestha 400 views
0 votes
2 answers
Can somebody write the code or algorithm, how merge sort works efficiently in linked list? Is Heap sort most inefficient in Linked List Sorting? Elaborate plz
asked Apr 29, 2019 in DS srestha 166 views
0 votes
1 answer
What does the following program do on two linked lists? Struct node *myFun (struct node * a, struct node * b) { Struct node *new = NULL ; If (a = = NULL) return (b) ; if (b = = NULL) return (a) ; If (a → data <= b → ... merges two linked lists by selecting the alternate nodes merges two sorted linked lists into final sorted linked list merges two linked lists by selecting the nodes in reverse.
asked Dec 27, 2018 in DS sharadsingh 185 views