O'Reilly logo

Learning F# Functional Data Structures and Algorithms by Adnan Masood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Algorithm – parenthesis matching using stacks

In computer science, stack data structure serves a variety of uses, from operating system function pointer management to compiler construction. We will try to be less ambitious and use the stack to solve the parenthesis matching problem. Instead of using the stack data structure explicitly, we will implicitly use stack operations to show you how to use the stack constructs within the algorithm.

A typical arithmetic expression is usually written as follows:

Algorithm – parenthesis matching using stacks

Here, the parentheses are being used to provide the order in which the operators will be applied in the statement. Also, in various programming languages, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required