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.
Study the given pattern carefully and select the number from among the given options that can replace the question mark (?) in it.
11 ...
In a certain code language,
A + B means ‘A is the brother of B’.
A − B means ‘A is the father of B’.
A × B means ‘A is...
Statements:
All notebooks are stationeries.
Some stationeries are pencils.
All pencils are costly.
Conclusions:
I...
If A denotes ‘+’, B denotes ‘×’, C denotes ‘−’, and D denotes ‘÷’, then what will be the value of the following expression?
3...
Select the figure from among the given options that can replace the question mark (?) and logically complete the series.
A, B, C, D, E, F and G are sitting around a circular table facing the centre (but not necessarily in the same order). G sits second to the left of F, wh...
Which two numbers should be interchanged to make the following equation correct?
(28 × 2) −16 × 6 + 8 × 3 + 5 × 7 = 39
(Note: Interc...
Read the directions carefully and answer the following question.
Vijay reached the office before Tony, but after Vinay. Megha reached office be...
Directions: A statement is given followed by two inferences I and II. You have to consider the statement to be true even if it seems to be at variance ...