Worst case is infinite: you just always take the path back in the direction of the entrance, and never even get past the first inlet.
Best case is O(n): you always take the path forward.
Worst case is infinite: you just always take the path back in the direction of the entrance, and never even get past the first inlet.
Best case is O(n): you always take the path forward.