Wednesday, January 28, 2009

Finding a loop in a list

Suppose you have a list of integers and you don't want to use any additional storage.
  1. Can you detect if the list has a loop?
  2. If it has, can you identify the node with two incoming edges?

1 comment:

  1. I was able to solve 1 in linear time, but not 2. Dakkar made it!