Is my approach correct?
Problem : There is a hill and few taps are present, all connected to other taps above/below, find which tap will be the last one to get water from a spring on the top of the mountain.
My Approach : Now I understand this is a connected graph problem. And by doing Breadth First Traversal we can get the last tap which will get the water.
Doubt : 1. Is my solution correct? If yes, then does BFT always gives the right answer? 2. Is there any other approach I'm not seeing?
Open Chat in New Window