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.
If P means ‘multiplied by’, T means ‘subtracted from’, M means ‘added to’ and B means ‘divided by’, then 40 B 8 P 8 T 14 M 9 = ?
...If ‘+’ means ‘–’, ‘–’ means ‘÷’, ‘÷’ means ‘×’, and ‘×’ means ‘+’, what will come in place of the question mar...
Select the correct combination of mathematical signs that can sequentially replace '*' sign and balance the equation given below.
86 * (38 * 1...
Select the correct combination of mathematical signs that can sequentially replace the * signs and balance the given equation.
56 * 492 * 6 * 7 * 123 = 507
If ‘A’ means ‘divided by’, ‘B’ means ‘multiplied by’, ‘C’ means ‘added by’ and ‘D’ means ‘subtracted from’, than – 105...
The given equation has been solved on the basis of a certain rule. Find the correct answer for the unsolved equation on that basis:
If a ÷...
Select the correct combination of mathematical signs that can sequentially replace the * signs and balance the given equation.
60 * 48 * 36 * 6 * 15 * 53
Which one of the given mathematical operations will result in 291?
If ‘A’ means (÷), ‘B’ means (×), ‘C’ means (+), and ‘D’ means (-), then ____ is the value of the expression.
25 A 5 B 8 D 6 C 4...
Select the correct combination of mathematical signs to replace the '*' signs and to balance the given equation.
169 * 13 * 30 * 12 * 4 * 18 = 85