Quantcast
Channel: How to detect a loop in a linked list? - Stack Overflow
Viewing all articles
Browse latest Browse all 30

Answer by Eduardo for How to detect a loop in a linked list?

$
0
0

You could even do it in constant O(1) time (although it would not be very fast or efficient): There is a limited amount of nodes your computer's memory can hold, say N records. If you traverse more than N records, then you have a loop.


Viewing all articles
Browse latest Browse all 30

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>