Java: converting infix to postfix notation using stack | Implementation using java

Опубликовано: 28 Октябрь 2024
на канале: CODE ZERO
4,428
64

in this video we;ll be converting infix notation to postfix notation using stack.
i'll be using netbeans ide..
#java
#stack
#infixtopostfix
#code_zero
code for stack is provided below(copy & paste it):

class Stack
{

int top=-1;
int size=0;
char[] arr;

public Stack(int size)
{
arr= new char[size];
this.size=size;
}
public void push(char num)
{
arr[++top]=num;
}

public char pop()
{
return arr[top--];
}

public char peek()
{
return arr[top];
}

public char peekn(int i)
{
return arr[i];
}
public int size()
{
return top+1;
}
public boolean isEmpty()
{
return top==-1;
}
}