3 ms·
In this instance, you're only concerned with the average case. Worst case is infinite: you just always take the path back in the direction of the entrance, and
by nwallin 6y ago
In this instance, you're only concerned with the average case.
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.
- jchw 6y agoYep, sorry, it quickly became apparent after rereading this that the original analysis was not worst-case. I have revised my comment to also include how I view calculating the actual time complexity since I didn't actually do that initially.