O'Reilly logo

C++ Data Structures and Algorithms by Wisnu Anggoro

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

Another example of Stack ADT implementation

Another implementation of the stack is when the programming language checks the parenthesis expression's validity. For instance, in C++, we need to scope the bunch of lines using curly braces ({}); or, when initializing an array, we need a square bracket ([]) to define the length of the array. It needs to ensure that the open curly brace has the closed curly brace, or the open square bracket has the close square bracket. Let's see the following possibility for the parenthesis expression:

{ ( ) [ { } ] }{ ( [ ) } ]{ ( ) } [

There are three lines in the preceding parenthesis expression for possibilities. In the first line, we can see that each opened parenthesis has its own closed parenthesis. It's ...

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