Question
In the design and analysis of algorithms, which of the
following algorithms is based on the greedy approach?Solution
Dijkstra’s algorithm is based on the greedy approach, which selects the locally optimal solution at each step with the goal of finding the shortest path from the source to all other vertices in a graph. The algorithm repeatedly picks the nearest unvisited vertex and calculates the shortest path to all its neighbors, ensuring optimal solutions for each subproblem. Merge Sort : A divide-and-conquer algorithm, not greedy. Depth-First Search : DFS is a traversal technique, not a greedy algorithm. Bellman-Ford Algorithm : This algorithm can handle negative weight edges, but it is not based on the greedy approach. Quick Sort : A divide-and-conquer algorithm, not greedy.
In a mixture of 40 liters, the ratio of milk to water is 5:3. How much milk must be replaced by water so that the new ratio becomes 1:1?
- Out of 750 students, the ratio of boys to girls is 6:4. The ratio of boys who passed to those who failed is 8:1, and that of girls is 7:3. How many student...
 If the ratio between two numbers is 3: 5 and their LCM is 120, then the numbers are:
- ‘P’, ‘Q’ and ‘R’ divide a certain amount among themselves. The average of their shares is Rs. 4860. Share of ‘P’ is 12(1/2)% more than shar...
 - Class ‘K’ has number of girls as 90% of boys in that class. Class ‘L’ has 10% fewer boys than class ‘K’ and 35% more total students than class ...
 The salaries of Ravi and Sumit are in the ratio 4: 5. If the salary of each is increased by Rs6,000 the new ratio becomes 35:40. What will be Sumit's in...
A boy is supposed to distribute Rs.2400 among his three friends P, Q and R in the ratio of 5:3:4 respectively, but mistakenly he distributed in the rati...
A plot has to be divided among P, Q and R in the ratio 3:4:6 respectively. If the area of plot received by R is 4800m ² more than the area of plot ...
The respective ratio of the number of shops to the number of fans sold in a city was 7:190 in 2016. In 2017, the number of fans sold increased by 20% an...
The ratio between two numbers is 7:8. If each number is increased by 9, the ratio between then become 10:11, find the difference between numbers.