I'm looking for best algorithms to compare two Circular Linked List?

For example :

List 1 = 1-3-5

List 2 = 3-5-1

I want to compare "same" or "not same" but need fast algorithm.

  • $\begingroup$ This is solved in linear time on stackoverflow: stackoverflow.com/a/2555887/940550. $\endgroup$ – Yuval Filmus Dec 14 '17 at 14:11
  • $\begingroup$ Are you sure @YuvalFilmus ? This solution is so long ? $\endgroup$ – Ali Baran Dec 14 '17 at 14:25
  • $\begingroup$ Fortunately, I don't have to be sure - it's your question, not mine. Now that you know how the problem is called and what algorithms can be relevant, you should be able to figure out the answer yourself. $\endgroup$ – Yuval Filmus Dec 14 '17 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.