Hello everyone! Please help with writing a program. It's Very necessary. Write a program Intersection of two cyclic lists. Knowing that Intersection - the result contains elements that are simultaneously present in both data structures. I need in full program code. I'll be very grateful. Thanks!
if the lists are massive, you need to make one of them easy to search so the above goes back to near O(N). Its the same approach: take item in list 1, ask if it is in list 2, you are just making that inner loop go away with a little extra effort. If its just a homework or small problem, don't need to sweat that, but hopefully you can see that its identical logic