algorithms.tutorialhorizon.com
Find the nearest building which has bike | Find nearest specific vertex from source in a graph.
Given a matrix (NxN) which represents the buildings in community. You are in a building and you need a bike to travel. There are few buildings in community which has bikes which you can take for your ride. Write an algorithm to find the nearest building which has bike and distance from your building. NOTE: All buildings are at equal distance from its neighbor's. Building's e matrix is represented as 0 or 1. If bike is present in that building then 1 else 0.