0% found this document useful (0 votes)
4 views

Data Structure and Algorithm_

Uploaded by

kusumitadas2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Data Structure and Algorithm_

Uploaded by

kusumitadas2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Topic Name: Convert Infix to Postfix

SUBMITTED BY : Kusumita Das

ROLL NO. : 33200122111

YEAR : 2ND YEAR (2022-2026)

BRANCH : CSE

SUBJECT : Data Structure and Algorithm(PCC-CS301)


Index

1. Introduction

2. Infix Notation

3. Postfix Notation

4. Conversion [Infix to Postfix]


Introduction

❑ Mathematical formulas are often made more accessible by using parenthesis. However, in
computers, expression with multiple parentheses can be inefficient. So, mathematicians have created
different notations such as infix, prefix, and postfix expressions to reduce computational work.

❑ The way to write arithmetic expression is known as a notation. An arithmetic expression can be written in three
different but equivalent notations, i.e., without changing the essence or output of an expression. These notations
are −
1. Infix Notation

2.Prefix (Polish) Notation

3.Postfix (Reverse-Polish) Notation

These notations are named as how they use operator in expression.


Definition of Infix and Postfix

❑ Infix Notation:
We write expression in infix notation, e.g. a - b + c, where operators are used in-between
operands. It is easy for us humans to read, write, and speak in infix notation but the same does not
go well with computing devices. An algorithm to process infix notation could be difficult and costly
in terms of time and space consumption.

❑ Postfix Notation:
This notation style is known as Reversed Polish Notation. In this notation style, the operator
is postfixed to the operands i.e., the operator is written after the operands. For example, ab+. This is
equivalent to its infix notation a + b.
conversion

❑ Question:(T*I/G^Y)-(A^B/C-D)/H
Infix character scanned stack Postfix expression

( (
T ( T
* (* T
I (* TI
/ (*/ TI
G (*/ TIG
^ (*/^ TIG
Y (*/^ TIGY
) (*/^) TIGY^/*
- - TIGY^/*
( -( TIGY^/*
A -( TIGY^/*A
^ -(^ TIGY^/*A
B -(^ TIGY^/*AB
/ -(/ TIGY^/*AB^
C -(/ TIGY^/*AB^C
- -(- TIGY^/*AB^C/
D -(- TIGY^/*AB^C/D
) -(-) TIGY^/*AB^C/D-
/ -/ TIGY^/*AB^C/D-
H -/ TIGY^/*AB^C/D-H/-
CONCLUSION

The infix, prefix, and postfix notations are three different ways of writing and evaluating
expressions.
While infix expressions are common and intuitive for humans to read and write, prefix and postfix
notations are computationally efficient and valuable for creating computer programs that
manipulate expressions.
In particular, we can easily evaluate the postfix expressions with a stack data structure, making
them appropriate for implementing some algorithms, such as parsers.
DECLARATION

I heíeby declaíe that this ppt is made by me only and not downloaded oí copied fíom any
otheí souíces.

Date: 07.08.2023
Name-Kusumita Das
Roll no- 33200122111

You might also like