java: converting postfix to prefix || implementation of stack

Опубликовано: 16 Июнь 2025
на канале: CODE ZERO
327
16

in this video i'll be converting postfix notation to prefix notation using stack.
watch this tutorial of conversion of infix to postfix:    • Java: converting infix to postfix notation...  
watch this tutorial for conversion of infix to prefix:    • Java: convert infix to prefix using java |...  

code for stackString class:

class StackString
{

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

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

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

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

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