Question
Which of the following traversal algorithms is
guaranteed to visit all vertices in the minimum number of edges in an unweighted graph?Solution
In an unweighted graph, Breadth-First Search (BFS) is optimal for finding the shortest path in terms of the number of edges. BFS explores all vertices at the current depth level before moving on to the next level, ensuring that the shortest path is found when the destination vertex is first encountered. For unweighted graphs, the edge count represents the path cost, and BFS efficiently identifies the shortest path by expanding vertices layer by layer. Why Other Options Are Incorrect: 1. Depth-First Search (DFS): DFS explores as far as possible along a branch before backtracking, which does not guarantee the shortest path in terms of edges. 2. Dijkstra’s Algorithm: While Dijkstra’s algorithm is used for weighted graphs, it is not necessary for unweighted graphs where BFS suffices. 3. Prim’s Algorithm: Prim’s algorithm is used for finding minimum spanning trees, not shortest paths. 4. Bellman-Ford Algorithm: While Bellman-Ford can handle negative weights, it is computationally expensive compared to BFS for unweighted graphs.
An item's price is set 25% higher than its cost price. After applying two consecutive discounts of 20% and 25%, it is sold for Rs. 1,500. Calculate the ...
An article Marked price is 30% above its cost price and it is sold at a discount of 10% making a profit of Rs.850.Then, what will be the selling price o...
A invested Rs. X in a business. After four months B Joined him with Rs. 7X and A double his investment. If at the end of the years total profit is Rs. 4...
The cost price of 15 mangoes is Rs.220. Because of bad quality of mangoes, the shopkeeper has to sell mangoes at a loss that is equal to selling price o...
Viru has Rs. 9000. He gives this money to Mahi on simple interest and after 4 years received the double amount. If the interest rate is 5% more than the...
- The ratio of the marked price and cost price of an item is 9:6. If the discount allowed is equal to the profit earned, find the profit percentage.
A shopkeeper bought a mobile phone for Rs. 18,500 and sold it for Rs. 21,275. What percentage of profit did he earn in this transaction?
A trader marked an article 20% above its cost price and sold it after allowing a discount of 15%. If the transaction resulted in a profit of Rs. 22, the...
Ram sold a copy at a profit of 15%. Had he sold it for Rs 48 more, 21% would have been gained. Find the cost price?
Ravi bought two products, ‘M’ and ‘N’, at the same price. He added a markup of 20% on ‘M’ and 50% on ‘N’. Then, he gave a discount of Rs...