Fixed bugs.

This is accepted on UVA
-returning 0 was nonsense in the search algorithm.
-needed to check for case where the path ended before ttl reached 0