1) Get count of the nodes in first list, let count be c1.
2) Get count of the nodes in 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)

On Jan 12, 3:28 pm, juver++ <avpostni...@gmail.com> wrote:
> However, sorting works faster than your straighforward solution.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to