Q. Enlist some applications of Stacks.


Answer =

Because of LIFO property of Stacks, they are used in various applications like:
• Reversal of a sequence.
• The compilers use Stacks to store the previous state of a program when a function is called or during recursion.
• Another important Stack application is backtracking. (Backtracking is a form of recursion. But it involves choosing only option out of any possibilities.) Backtracking is used in a large number of puzzles like Sudoku, etc., and in optimization problems such as the knapsack problem.
• "Undo" mechanism in text editors: This operation is accomplished by keeping all text changes in a Stack.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post