Start learning 50% faster. Sign in now
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.
The main aim of the attacks of Muhammad-bin-Tughluq in south India was
Ayagara in Vijayanagar were
Who was the last ruler of Mauryan dynasty?
Who was responsible for the destruction of Vikramashila, one of the three major Buddhist monasteries in India during the Pala Empire?
The Hoysala Empire was a Kannadiga power originating from the Indian subcontinent that ruled most of what is now Karnataka between the 10th ...
The city of Ajmer was founded by
Jayachandra, a historical ruler, belonged to which of the following dynasties?
During which ruler's reign did Pietra dura, the art of inlaying colored stones into marble, gain popularity?
Who was the visionary behind the construction of Hyderabad's iconic Charminar?
Who was known as ‘Andhra-Bhoja’?