Data Structure


Queue is a linear data structure. It follows First In First Out (FIFO). In other words, the item which is inserted first is accessed/deleted first. For example, when you go to cashier in a mall, then the person first in line is served first. This is a queue. Basic Operations:- enqueue/push: Insert item in the …

Queue Read More »

Postfix to Infix

We can convert any postfix expression to infix expression using stack in one pass. Example Input: abc^d/e*+ Output: (a+(((b^c)/d)*e)) Postfix to Infix Algorithm Steps Initialize an empty stack. Scan postfix expression from left to right. If the scanned character is an operand, push it to the stack. If the scanned character is an operator, Pop …

Postfix to Infix Read More »

Infix to Postfix

We will study how we can convert infix expression to postfix expression using stack. Infix Expression Infix Expression is in the form of Operand Operator Operand.For example, 4 + 5. Postfix Expression ( or Reverse Polish Notation ) Postfix Expression is in form Operand Operand Operator.For example, 4 5 +. Before moving ahead we must …

Infix to Postfix Read More »