Data Structure
Stack
C . C++ . Java
Stacks
A Stack is a linear data structure in which items may be added or removed only at one
end. This end is called the ‘Top’.
The last item to be added is the first item to be removed.
Basic Stack Operations
PUSH : Insert an element in the stack
POP : Remove an element from the stack 6 10 3
Array representation of Stacks
A Linear Array : Stack
6 10 3
A variable pointing to the index of topmost element : Top
A variable to store the maximum size of the stack : MaxStack
Showstack( )
Displays the content of the stack
isFull( )
Boolean function for checking if
the stack has reached max array
size.
isEmpty( )
Boolean function for checking if
the stack is empty
Push( )
Insert an element in the
stack
Pop( )
Remove an element from the
stack
01 02 03
04 05
Push( ) and Pop( )
6 10 3
Polish Notation
Postfix, Infix, Prefix
Technopedia.com
Polish notation was invented in 1924 by Jan Lukasiewicz, a Polish
logician and philosopher, in order to simplify sentential logic. The idea
is simply to have a parenthesis-free notation that makes each
equation shorter and easier to parse in terms of defining the evaluation
priority of the operators.
a series or system of written symbols used to represent
numbers, amounts, or elements in something such as
music or mathematics.
Notation
Polish Notation
Let Q be an arithmetic expression with the following precedence order for operations:
Highest : Exponentiation (^)
Next Highest : Multiplication (*), Division (/)
Lowest : Addition (+), Subtraction (-)
In a parenthesis free expression, operations on the same level are performed left to
right.
2 ^ 3 + 5 * 2 ^ 2 – 12 / 6 8 + 5 * 4 – 12 / 6
8 + 20 – 2 28 – 2 = 26
Infix Notation
It is the notation where operator symbols are placed between operands.
A+B C-D E*F G/H
parenthesis are required to distinguish operations like (A+B)*C and A+(B*C).
Prefix/ Polish Notation
It is the notation where operator symbols are placed before operands.
+AB -CD *EF /GH
No parenthesis are required.
Postfix/ Reverse Polish Notation
It is the notation where operator symbols are placed after operands.
AB+ CD- EF* GH/
No parenthesis are required.
Postfix/ Reverse Polish Notation
It is the notation where operator symbols are placed after operands.
AB+ CD- EF* /GH
2,405.8
Big numbers catch your audience’s attention
Resources
Course catalog
Mercury is the closest planet to the
Sun and the smallest one
Faculty
Earth is the only known planet to
harbor life
Student org.
Venus has a beautiful name and is
the second planet from the Sun
Job center
Saturn is a gas giant and has
several rings around it
Program schedule
Hour Mon Tue Wed Thu Fri
8:00
Computer
science 101
Marketing Programming
Computer
science 101
10:00 Programming History 1
12:00
History 1
Physics 2
14:00 Physics 2 Programming
Neptune is the farthest
planet from the Sun
Jupiter is the biggest planet
of them all
Saturn is a gas giant and
has several rings
80% 43% 70%
Admission rate
AWESOME
WORDS
Preparing for your degree
Step #01
Jupiter is the biggest
planet of all
Step #02
Neptune is the
farthest planet
Step #03
Earth is the beautiful
planet we live on
Step #04
Pluto is considered a
dwarf planet
This degree around the world
Standard degrees
Jupiter is the biggest planet in the
entire Solar System
Top degrees
Saturn is the ringed planet and also
a gas giant
2021
Ceres is located in the main asteroid belt
24.52 km
is the distance between Earth and the Moon
—SOMEONE FAMOUS
“This is a quote, words full of wisdom
that someone important said and can
make the reader get inspired.”
Our team
Tom Hannock
You can describe your team
member here
Lisa Mendoza
You can describe your team
member here
Jon Winter
You can describe your team
member here
Social Media
manav_sanger
CREDITS: This presentation template was created by
Slidesgo, including icons by Flaticon, and infographics
& images by Freepik
THANKS!
Do you have any questions?
addyouremail@freepik.com
+91 620 421 838
yourcompany.com
Please keep this slide as attribution

Stack - Data structure in C, C++ and Java

  • 1.
  • 2.
    Stacks A Stack isa linear data structure in which items may be added or removed only at one end. This end is called the ‘Top’. The last item to be added is the first item to be removed. Basic Stack Operations PUSH : Insert an element in the stack POP : Remove an element from the stack 6 10 3
  • 3.
    Array representation ofStacks A Linear Array : Stack 6 10 3 A variable pointing to the index of topmost element : Top A variable to store the maximum size of the stack : MaxStack
  • 4.
    Showstack( ) Displays thecontent of the stack isFull( ) Boolean function for checking if the stack has reached max array size. isEmpty( ) Boolean function for checking if the stack is empty Push( ) Insert an element in the stack Pop( ) Remove an element from the stack 01 02 03 04 05
  • 5.
    Push( ) andPop( ) 6 10 3
  • 6.
  • 7.
    Technopedia.com Polish notation wasinvented in 1924 by Jan Lukasiewicz, a Polish logician and philosopher, in order to simplify sentential logic. The idea is simply to have a parenthesis-free notation that makes each equation shorter and easier to parse in terms of defining the evaluation priority of the operators. a series or system of written symbols used to represent numbers, amounts, or elements in something such as music or mathematics. Notation
  • 8.
    Polish Notation Let Qbe an arithmetic expression with the following precedence order for operations: Highest : Exponentiation (^) Next Highest : Multiplication (*), Division (/) Lowest : Addition (+), Subtraction (-) In a parenthesis free expression, operations on the same level are performed left to right. 2 ^ 3 + 5 * 2 ^ 2 – 12 / 6 8 + 5 * 4 – 12 / 6 8 + 20 – 2 28 – 2 = 26
  • 9.
    Infix Notation It isthe notation where operator symbols are placed between operands. A+B C-D E*F G/H parenthesis are required to distinguish operations like (A+B)*C and A+(B*C).
  • 10.
    Prefix/ Polish Notation Itis the notation where operator symbols are placed before operands. +AB -CD *EF /GH No parenthesis are required.
  • 11.
    Postfix/ Reverse PolishNotation It is the notation where operator symbols are placed after operands. AB+ CD- EF* GH/ No parenthesis are required.
  • 12.
    Postfix/ Reverse PolishNotation It is the notation where operator symbols are placed after operands. AB+ CD- EF* /GH
  • 13.
    2,405.8 Big numbers catchyour audience’s attention
  • 14.
    Resources Course catalog Mercury isthe closest planet to the Sun and the smallest one Faculty Earth is the only known planet to harbor life Student org. Venus has a beautiful name and is the second planet from the Sun Job center Saturn is a gas giant and has several rings around it
  • 15.
    Program schedule Hour MonTue Wed Thu Fri 8:00 Computer science 101 Marketing Programming Computer science 101 10:00 Programming History 1 12:00 History 1 Physics 2 14:00 Physics 2 Programming
  • 16.
    Neptune is thefarthest planet from the Sun Jupiter is the biggest planet of them all Saturn is a gas giant and has several rings 80% 43% 70% Admission rate
  • 17.
  • 18.
    Preparing for yourdegree Step #01 Jupiter is the biggest planet of all Step #02 Neptune is the farthest planet Step #03 Earth is the beautiful planet we live on Step #04 Pluto is considered a dwarf planet
  • 19.
    This degree aroundthe world Standard degrees Jupiter is the biggest planet in the entire Solar System Top degrees Saturn is the ringed planet and also a gas giant
  • 20.
    2021 Ceres is locatedin the main asteroid belt 24.52 km is the distance between Earth and the Moon
  • 21.
    —SOMEONE FAMOUS “This isa quote, words full of wisdom that someone important said and can make the reader get inspired.”
  • 22.
    Our team Tom Hannock Youcan describe your team member here Lisa Mendoza You can describe your team member here Jon Winter You can describe your team member here
  • 23.
  • 24.
    CREDITS: This presentationtemplate was created by Slidesgo, including icons by Flaticon, and infographics & images by Freepik THANKS! Do you have any questions? addyouremail@freepik.com +91 620 421 838 yourcompany.com Please keep this slide as attribution