SlideShare a Scribd company logo
Data Structures
Lecture 3
RUBYA AFRIN
NORTHERN UNIVERSITY OF BUSINESS AND TECHNOLOGY
Stack
 A stack is a collection of items into which items can be
inserted or deleted at one end.
 A stack implements the LIFO (Last In First Out)protocol
2
Stacks
 Stacks in real life: stack of books, stack of plates
 Add new items at the top
 Remove an item at the top
 Stack data structure similar to real life: collection of elements
arranged in a linear order.
 Can only access element at the top
3
Stack Operations
 Push(X) – insert X as the top element of the stack
 Pop() – remove the top element of the stack and return it.
 Top() – return the top element without removing it from the stack.
4
Stack Operations
push(2)
top 2
push(5)
top
2
5
push(7)
top
2
5
7
push(1)
top
2
5
7
1
1 pop()
top
2
5
7
push(21)
top
2
5
7
21
21 pop()
top
2
5
7
7 pop()
2
5top
5 pop()
2top
5
Stack Operation
 The last element to go into the stack is the first to come out: LIFO –
Last In First Out.
 What happens if we call pop() and there is no element?
 Have IsEmpty() boolean function that returns true if stack is empty,
false otherwise.
 Throw StackEmpty exception: advanced C++ concept.
6
Stack Operation
 Overflow: occurs if we try to insert an item into an array
which is full
 Underflow: occurs when we try to retrieve an item form
an empty list
7
Push Operation
 If the stack is full, print an error message (overflow)
 Make place for new item by incrementing top
 Put the item in place
8
Pop Operation
 If the stack is empty, print an error message an halt
execution (underflow)
 Remove the top element from the stack
 Return the element to the calling program
9
Stack using an Array
top
2
5
7
1
2 5 7 1
0 1 32 4
top = 3
10
Stack using an Array
 In case of an array, it is possible that the array may “fill-up” if we
push enough elements.
 Have a boolean function IsFull() which returns true is stack
(array) is full, false otherwise.
 We would call this function before calling push(x).
11
Stack Operations with Array
int pop()
{
return A[current--];
}
void push(int x)
{
A[++current] = x;
}
12
Stack Operations with Array
int top()
{
return A[current];
}
int IsEmpty()
{
return ( current == -1 );
}
int IsFull()
{
return ( current == size-1);
}
 A quick examination shows that all five operations take constant
time.
13
Stack Using Linked List
 We can avoid the size limitation of a stack implemented with an
array by using a linked list to hold the stack elements.
 As with array, however, we need to decide where to insert elements
in the list and where to delete them so that push and pop will run the
fastest.
14
Operations in dynamic stack 15
Use of Stack
 Example of use: prefix, infix, postfix expressions.
 Consider the expression A+B: we think of applying the operator “+”
to the operands A and B.
 “+” is termed a binary operator: it takes two operands.
 Writing the sum as A+B is called the infix form of the expression.
16
Prefix, Infix, Postfix
 Two other ways of writing the expression are
+ A B prefix
A B + postfix
 The prefixes “pre” and “post” refer to the position of the operator with
respect to the two operands.
17
Prefix, Infix, Postfix
 Consider the infix expression
A + B * C
 We “know” that multiplication is done before addition.
 The expression is interpreted as
A + ( B * C )
 Multiplication has precedence over addition.
18
Prefix, Infix, Postfix
 Conversion to postfix
(A + B ) * C infix form
19
Prefix, Infix, Postfix
 Conversion to postfix
(A + B ) * C infix form
( A B + ) * C convert addition
20
Prefix, Infix, Postfix
 Conversion to postfix
(A + B ) * C infix form
( A B + ) * C convert addition
( A B + ) C * convert multiplication
21
Prefix, Infix, Postfix
 Conversion to postfix
(A + B ) * C infix form
( A B + ) * C convert addition
( A B + ) C * convert multiplication
A B + C * postfix form
22
Precedence of Operators
 The five binary operators are: addition, subtraction, multiplication,
division and exponentiation.
 The order of precedence is (highest to lowest)
 Exponentiation 
 Multiplication/division*, /
 Addition/subtraction +, -
23
Infix to Postfix
Infix Postfix
A + B A B +
12 + 60 – 23 12 60 + 23 –
(A + B)*(C – D ) A B + C D – *
24
Converting Infix to Postfix
 Example: A + B * C
symb postfix stack
A A
25
Converting Infix to Postfix
 Example: A + B * C
symb postfix stack
A A
+ A +
26
Converting Infix to Postfix
 Example: A + B * C
symb postfix stack
A A
+ A +
B AB +
27
Converting Infix to Postfix
 Example: A + B * C
symb postfix stack
A A
+ A +
B AB +
* AB + *
28
Converting Infix to Postfix
 Example: A + B * C
symb postfix stack
A A
+ A +
B AB +
* AB + *
C ABC + *
29
Converting Infix to Postfix
 Example: A + B * C
symb postfix stack
A A
+ A +
B AB +
* AB + *
C ABC + *
ABC * +
30
Converting Infix to Postfix
 Example: A + B * C
symb postfix stack
A A
+ A +
B AB +
* AB + *
C ABC + *
ABC * +
ABC * +
31
Prefix, Infix, Postfix
 Conversion to postfix
A + ( B * C ) infix form
32
Prefix, Infix, Postfix
 Conversion to postfix
A + ( B * C ) infix form
A + ( B C * ) convert multiplication
33
Prefix, Infix, Postfix
 Conversion to postfix
A + ( B * C ) infix form
A + ( B C * ) convert multiplication
A ( B C * ) + convert addition
34
Converting Infix to Postfix
 Handling parenthesis
 When an open parenthesis ‘(‘ is read, it must be pushed on the
stack.
 This can be done by setting prcd(op,‘(‘ ) to be FALSE.
 Also, prcd( ‘(‘,op ) == FALSE which ensures that an operator after ‘(‘
is pushed on the stack.
35
Converting Infix to Postfix
 When a ‘)’ is read, all operators up to the first ‘(‘ must be popped and
placed in the postfix string.
 To do this, prcd( op,’)’ ) == TRUE.
 Both the ‘(‘ and the ‘)’ must be discarded: prcd( ‘(‘,’)’ ) == FALSE.
 Need to change line 11 of the algorithm.
36
Prefix, Infix, Postfix
 Conversion to postfix
A + ( B * C ) infix form
A + ( B C * ) convert multiplication
A ( B C * ) + convert addition
A B C * + postfix form
Symbol
Scanned
Stack Postfix
Notation
A empty A
+ + A
( +,( A
B +,( AB
* +,(,* AB
C +,(,* ABC
) ABC*+
37

More Related Content

PPT
Application of Stacks
Ain-ul-Moiz Khawaja
 
PPT
Circular queues
Ssankett Negi
 
PPTX
My lecture infix-to-postfix
Senthil Kumar
 
PPT
Expression evaluation
JeeSa Sultana
 
PPT
Infix prefix postfix
Self-Employed
 
PPT
Stack Data Structure V1.0
Zidny Nafan
 
PPT
Stack application
Student
 
DOC
Infix to-postfix examples
mua99
 
Application of Stacks
Ain-ul-Moiz Khawaja
 
Circular queues
Ssankett Negi
 
My lecture infix-to-postfix
Senthil Kumar
 
Expression evaluation
JeeSa Sultana
 
Infix prefix postfix
Self-Employed
 
Stack Data Structure V1.0
Zidny Nafan
 
Stack application
Student
 
Infix to-postfix examples
mua99
 

What's hot (20)

PPTX
Application of Stack - Yadraj Meena
Dipayan Sarkar
 
PDF
Applications of stack
A. S. M. Shafi
 
PPT
03 stacks and_queues_using_arrays
tameemyousaf
 
PDF
Infix to Prefix (Conversion, Evaluation, Code)
Ahmed Khateeb
 
PPTX
Stack data structure
Tech_MX
 
PPT
Conversion of Infix To Postfix Expressions
Kulachi Hansraj Model School Ashok Vihar
 
PPTX
Prefix, Infix and Post-fix Notations
Afaq Mansoor Khan
 
PPTX
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
PPT
Stack Operation In Data Structure
DivyeshKumar Jagatiya
 
PPTX
Stack_Application_Infix_Prefix.pptx
sandeep54552
 
PDF
Stack push pop
A. S. M. Shafi
 
PDF
Queue
A. S. M. Shafi
 
PPTX
stack
Raj Sarode
 
PPT
Stack
Tejas Patel
 
PPT
Stacks
Malainine Zaid
 
PPTX
Project of data structure
Umme habiba
 
PPTX
Operation on stack
chetan handa
 
PPT
MEngine Overview
euming
 
PDF
Lab 3 Multi-Function Gate
Katrina Little
 
Application of Stack - Yadraj Meena
Dipayan Sarkar
 
Applications of stack
A. S. M. Shafi
 
03 stacks and_queues_using_arrays
tameemyousaf
 
Infix to Prefix (Conversion, Evaluation, Code)
Ahmed Khateeb
 
Stack data structure
Tech_MX
 
Conversion of Infix To Postfix Expressions
Kulachi Hansraj Model School Ashok Vihar
 
Prefix, Infix and Post-fix Notations
Afaq Mansoor Khan
 
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Stack Operation In Data Structure
DivyeshKumar Jagatiya
 
Stack_Application_Infix_Prefix.pptx
sandeep54552
 
Stack push pop
A. S. M. Shafi
 
stack
Raj Sarode
 
Project of data structure
Umme habiba
 
Operation on stack
chetan handa
 
MEngine Overview
euming
 
Lab 3 Multi-Function Gate
Katrina Little
 
Ad

Similar to Data structures (20)

PPTX
Data Structure and Algorithms by Sabeen Memon03.pptx
msoomar8611
 
PPTX
Unit 3 Stacks and Queues.pptx
Yogesh Pawar
 
PDF
Data Structures And Algorithms(stacks queues)
lahariit406
 
PDF
Data structures stacks
maamir farooq
 
PPTX
PPT Lecture 3.2.1 stack newxxxxxxxxxx.pptx
AdarshPrajapati26
 
PDF
Stack
Zaid Shabbir
 
PPT
Stack ppt file of Stack DSA For lab in the lab of DSA lecture and Lab.ppt
aamirali1061a
 
PPT
358 33 powerpoint-slides_9-stacks-queues_chapter-9
sumitbardhan
 
PPTX
Stacks and queues using aaray line .pptx
ramkumar649780
 
PPTX
Lec5-Stack-bukc-28022024-112316am (1) .pptx
haaamin01
 
PDF
Stacks
Sadaf Ismail
 
PPTX
DS-UNIT 3 FINAL.pptx
prakashvs7
 
PPTX
Stack - Data Structure - Notes
Omprakash Chauhan
 
PPTX
Data strutcure and annalysis topic stack
MihirMishra36
 
PPT
Lecture6
Muhammad Zubair
 
PPTX
Stack_Overview_Implementation_WithVode.pptx
chandankumar364348
 
PPT
01 stack 20160908_jintaek_seo
JinTaek Seo
 
PPTX
Stacks Data structure.pptx
line24arts
 
PDF
Stacks,queues,linked-list
pinakspatel
 
Data Structure and Algorithms by Sabeen Memon03.pptx
msoomar8611
 
Unit 3 Stacks and Queues.pptx
Yogesh Pawar
 
Data Structures And Algorithms(stacks queues)
lahariit406
 
Data structures stacks
maamir farooq
 
PPT Lecture 3.2.1 stack newxxxxxxxxxx.pptx
AdarshPrajapati26
 
Stack ppt file of Stack DSA For lab in the lab of DSA lecture and Lab.ppt
aamirali1061a
 
358 33 powerpoint-slides_9-stacks-queues_chapter-9
sumitbardhan
 
Stacks and queues using aaray line .pptx
ramkumar649780
 
Lec5-Stack-bukc-28022024-112316am (1) .pptx
haaamin01
 
Stacks
Sadaf Ismail
 
DS-UNIT 3 FINAL.pptx
prakashvs7
 
Stack - Data Structure - Notes
Omprakash Chauhan
 
Data strutcure and annalysis topic stack
MihirMishra36
 
Lecture6
Muhammad Zubair
 
Stack_Overview_Implementation_WithVode.pptx
chandankumar364348
 
01 stack 20160908_jintaek_seo
JinTaek Seo
 
Stacks Data structure.pptx
line24arts
 
Stacks,queues,linked-list
pinakspatel
 
Ad

More from Rokonuzzaman Rony (20)

PPTX
Course outline for c programming
Rokonuzzaman Rony
 
PPTX
Pointer
Rokonuzzaman Rony
 
PPTX
Operator Overloading & Type Conversions
Rokonuzzaman Rony
 
PPTX
Constructors & Destructors
Rokonuzzaman Rony
 
PPTX
Classes and objects in c++
Rokonuzzaman Rony
 
PPTX
Functions in c++
Rokonuzzaman Rony
 
PPTX
Object Oriented Programming with C++
Rokonuzzaman Rony
 
PPTX
Humanitarian task and its importance
Rokonuzzaman Rony
 
PPTX
Structure
Rokonuzzaman Rony
 
PPTX
Pointers
Rokonuzzaman Rony
 
PPTX
Introduction to C programming
Rokonuzzaman Rony
 
PPTX
Constants, Variables, and Data Types
Rokonuzzaman Rony
 
PPTX
C Programming language
Rokonuzzaman Rony
 
PPTX
User defined functions
Rokonuzzaman Rony
 
PPTX
Numerical Method 2
Rokonuzzaman Rony
 
PPT
Numerical Method
Rokonuzzaman Rony
 
PPTX
Data structures
Rokonuzzaman Rony
 
PPT
Data structures
Rokonuzzaman Rony
 
Course outline for c programming
Rokonuzzaman Rony
 
Operator Overloading & Type Conversions
Rokonuzzaman Rony
 
Constructors & Destructors
Rokonuzzaman Rony
 
Classes and objects in c++
Rokonuzzaman Rony
 
Functions in c++
Rokonuzzaman Rony
 
Object Oriented Programming with C++
Rokonuzzaman Rony
 
Humanitarian task and its importance
Rokonuzzaman Rony
 
Introduction to C programming
Rokonuzzaman Rony
 
Constants, Variables, and Data Types
Rokonuzzaman Rony
 
C Programming language
Rokonuzzaman Rony
 
User defined functions
Rokonuzzaman Rony
 
Numerical Method 2
Rokonuzzaman Rony
 
Numerical Method
Rokonuzzaman Rony
 
Data structures
Rokonuzzaman Rony
 
Data structures
Rokonuzzaman Rony
 

Recently uploaded (20)

PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
CDH. pptx
AneetaSharma15
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 

Data structures

  • 1. Data Structures Lecture 3 RUBYA AFRIN NORTHERN UNIVERSITY OF BUSINESS AND TECHNOLOGY
  • 2. Stack  A stack is a collection of items into which items can be inserted or deleted at one end.  A stack implements the LIFO (Last In First Out)protocol 2
  • 3. Stacks  Stacks in real life: stack of books, stack of plates  Add new items at the top  Remove an item at the top  Stack data structure similar to real life: collection of elements arranged in a linear order.  Can only access element at the top 3
  • 4. Stack Operations  Push(X) – insert X as the top element of the stack  Pop() – remove the top element of the stack and return it.  Top() – return the top element without removing it from the stack. 4
  • 5. Stack Operations push(2) top 2 push(5) top 2 5 push(7) top 2 5 7 push(1) top 2 5 7 1 1 pop() top 2 5 7 push(21) top 2 5 7 21 21 pop() top 2 5 7 7 pop() 2 5top 5 pop() 2top 5
  • 6. Stack Operation  The last element to go into the stack is the first to come out: LIFO – Last In First Out.  What happens if we call pop() and there is no element?  Have IsEmpty() boolean function that returns true if stack is empty, false otherwise.  Throw StackEmpty exception: advanced C++ concept. 6
  • 7. Stack Operation  Overflow: occurs if we try to insert an item into an array which is full  Underflow: occurs when we try to retrieve an item form an empty list 7
  • 8. Push Operation  If the stack is full, print an error message (overflow)  Make place for new item by incrementing top  Put the item in place 8
  • 9. Pop Operation  If the stack is empty, print an error message an halt execution (underflow)  Remove the top element from the stack  Return the element to the calling program 9
  • 10. Stack using an Array top 2 5 7 1 2 5 7 1 0 1 32 4 top = 3 10
  • 11. Stack using an Array  In case of an array, it is possible that the array may “fill-up” if we push enough elements.  Have a boolean function IsFull() which returns true is stack (array) is full, false otherwise.  We would call this function before calling push(x). 11
  • 12. Stack Operations with Array int pop() { return A[current--]; } void push(int x) { A[++current] = x; } 12
  • 13. Stack Operations with Array int top() { return A[current]; } int IsEmpty() { return ( current == -1 ); } int IsFull() { return ( current == size-1); }  A quick examination shows that all five operations take constant time. 13
  • 14. Stack Using Linked List  We can avoid the size limitation of a stack implemented with an array by using a linked list to hold the stack elements.  As with array, however, we need to decide where to insert elements in the list and where to delete them so that push and pop will run the fastest. 14
  • 16. Use of Stack  Example of use: prefix, infix, postfix expressions.  Consider the expression A+B: we think of applying the operator “+” to the operands A and B.  “+” is termed a binary operator: it takes two operands.  Writing the sum as A+B is called the infix form of the expression. 16
  • 17. Prefix, Infix, Postfix  Two other ways of writing the expression are + A B prefix A B + postfix  The prefixes “pre” and “post” refer to the position of the operator with respect to the two operands. 17
  • 18. Prefix, Infix, Postfix  Consider the infix expression A + B * C  We “know” that multiplication is done before addition.  The expression is interpreted as A + ( B * C )  Multiplication has precedence over addition. 18
  • 19. Prefix, Infix, Postfix  Conversion to postfix (A + B ) * C infix form 19
  • 20. Prefix, Infix, Postfix  Conversion to postfix (A + B ) * C infix form ( A B + ) * C convert addition 20
  • 21. Prefix, Infix, Postfix  Conversion to postfix (A + B ) * C infix form ( A B + ) * C convert addition ( A B + ) C * convert multiplication 21
  • 22. Prefix, Infix, Postfix  Conversion to postfix (A + B ) * C infix form ( A B + ) * C convert addition ( A B + ) C * convert multiplication A B + C * postfix form 22
  • 23. Precedence of Operators  The five binary operators are: addition, subtraction, multiplication, division and exponentiation.  The order of precedence is (highest to lowest)  Exponentiation   Multiplication/division*, /  Addition/subtraction +, - 23
  • 24. Infix to Postfix Infix Postfix A + B A B + 12 + 60 – 23 12 60 + 23 – (A + B)*(C – D ) A B + C D – * 24
  • 25. Converting Infix to Postfix  Example: A + B * C symb postfix stack A A 25
  • 26. Converting Infix to Postfix  Example: A + B * C symb postfix stack A A + A + 26
  • 27. Converting Infix to Postfix  Example: A + B * C symb postfix stack A A + A + B AB + 27
  • 28. Converting Infix to Postfix  Example: A + B * C symb postfix stack A A + A + B AB + * AB + * 28
  • 29. Converting Infix to Postfix  Example: A + B * C symb postfix stack A A + A + B AB + * AB + * C ABC + * 29
  • 30. Converting Infix to Postfix  Example: A + B * C symb postfix stack A A + A + B AB + * AB + * C ABC + * ABC * + 30
  • 31. Converting Infix to Postfix  Example: A + B * C symb postfix stack A A + A + B AB + * AB + * C ABC + * ABC * + ABC * + 31
  • 32. Prefix, Infix, Postfix  Conversion to postfix A + ( B * C ) infix form 32
  • 33. Prefix, Infix, Postfix  Conversion to postfix A + ( B * C ) infix form A + ( B C * ) convert multiplication 33
  • 34. Prefix, Infix, Postfix  Conversion to postfix A + ( B * C ) infix form A + ( B C * ) convert multiplication A ( B C * ) + convert addition 34
  • 35. Converting Infix to Postfix  Handling parenthesis  When an open parenthesis ‘(‘ is read, it must be pushed on the stack.  This can be done by setting prcd(op,‘(‘ ) to be FALSE.  Also, prcd( ‘(‘,op ) == FALSE which ensures that an operator after ‘(‘ is pushed on the stack. 35
  • 36. Converting Infix to Postfix  When a ‘)’ is read, all operators up to the first ‘(‘ must be popped and placed in the postfix string.  To do this, prcd( op,’)’ ) == TRUE.  Both the ‘(‘ and the ‘)’ must be discarded: prcd( ‘(‘,’)’ ) == FALSE.  Need to change line 11 of the algorithm. 36
  • 37. Prefix, Infix, Postfix  Conversion to postfix A + ( B * C ) infix form A + ( B C * ) convert multiplication A ( B C * ) + convert addition A B C * + postfix form Symbol Scanned Stack Postfix Notation A empty A + + A ( +,( A B +,( AB * +,(,* AB C +,(,* ABC ) ABC*+ 37