Stacks are crucial in recursive algorithms because they support backtracking by maintaining a history of function calls. Every recursive call is pushed onto the stack, and when a base condition is met, the stack unwinds (pops) the calls in reverse order. This property is integral for problems like solving mazes, tree traversal (DFS), or evaluating expressions. The Last-In-First-Out (LIFO) nature of stacks ensures that the most recent state is resumed first, making them perfect for backtracking scenarios. Why Other Options Are Incorrect · Option 1 (Efficient sorting): Stacks are not inherently used for sorting. Algorithms like Quick Sort and Merge Sort do not directly depend on stacks for sorting efficiency. · Option 2 (Memory allocation for variables): This is managed by the program's runtime stack, not the data structure itself. · Option 4 (Managing concurrent processes): This is more relevant to queues or process schedulers. · Option 5 (Sorting data): Stacks are used in algorithms like stack-based parsing but are not designed for general sorting.
A boat takes 20 hours to travel 260 km downstream. The speed of the boat in still water is 125% greater than the speed of the stream. If the boat comple...
The time taken by a boat to travel 'd' kilometers downstream is 8 hours, while the time taken to travel (d - 60) kilometers upstr...
A boy can swim in water with a speed of 12 km/hr in still water. If the speed of the stream is 4 km/hr, what will be the time taken by the boy to cover ...
The speed of a boat in downstream and upstream is 30 km/hr and 22 km/hr, respectively. Find the approximate time taken by the boa...
A boat can cover a distance of 210 km downstream with the current in 5 hours. It takes an additional 2.5 hours to return the same...
The speed of a boat in still water is 20 km/hr. If the boat covers 120 km in upstream in 12 hours, then find the time taken by the boat to travel 150 km...
A boat travels in a river where the current flows at a speed of 5 km/h. The total time taken by the boat to go from point 'P' to ...
A boat can travel 18 km downstream in 2 hours and 12 km upstream in 3 hours. What is the speed of the boat in still water?
A boat travels the same distance 'd' km in both upstream and downstream directions, taking a total of 15 hours for the round trip. If the downstream spe...
A boat can travel 8 km more in downstream than that in upstream, in 8 hours while the difference between the time taken by the same boat to travel 200 k...