- What is a Data Structure & Types of Data Structures
- What is an Algorithm & It's Characteristics
- Asymptotic Notations
- What is Space Complexity
- Array in Data Structure
- Algorithm for Insertion in Array
- Sparse Matrix
- Introduction to a Linked List
- Algorithm to Insert a Node at the End of the Linked list
- Algorithm to Insert a Node at the Front of the Linked List
- Algorithm to Delete a Node from Linked list
- Circular Linked List
- Algorithm to Insert a Node in the Circular Linked list
- Algorithm to Delete a Node from the Circular Linked list
- Doubly Linked List
- Algorithm to Insert a Node at the End of the Doubly Linked list
- Algorithm to Delete a Node from the Doubly Linked List
- Stack Data Structure
- Algorithm to convert Infix to Postfix
- Queue Data Structure
- Circular Queue in Data Structure
Algorithm to convert Infix to Postfix
Let, X is an
arithmetic expression written in infix notation. This algorithm finds the
equivalent postfix expression Y.
- Push
“(“onto Stack, and add “)” to the end of the given arithmetic expression.
- Scan
the given expression from left to right and repeat step 3 to 6 until the
Stack is empty.
- If
an operand is encountered, add it to expression.
- If a
left parenthesis is encountered, push it onto Stack.
- If
an operator is encountered ,then:
- Repeatedly
pop from Stack and add to expression each operator (on the top of Stack)
which has the same precedence as or higher precedence than operator.
- Add
operator to Stack.
- [End
of If]
- If a
right parenthesis is encountered ,then:
- Repeatedly
pop from Stack and add to expression each operator (on the top of Stack)
until a left parenthesis is encountered.
- Remove
the left Parenthesis.
- [End
of If]
- [End
of If]
- END.