What are the big o notation for this code below. I still couldn't grasp the concept fully. I am supposed to get a thought from experienced coders to give a summary for the big o performance based on this code.
import java.util.*;
import java.util.InputMismatchException;
import javax.swing.*;
public class MyStack {
private int maxSize;
private long[] stackArray;
private int top;
public MyStack(int s) {
maxSize = s;
stackArray = new long[maxSize];
top = -1;
}
public void push(long j) {
stackArray[++top] = j;
System.out.println("Push onto stack");
}
public long pop() {
return stackArray[top--];
}
public long peek() {
return stackArray[top];
}
public boolean isEmpty() {
return (top == -1);
}
public boolean isFull() {
return (top == maxSize - 1);
}
public static void main(String[] args) {
Scanner num = new Scanner(System.in);
int input =0;
int x;
MyStack theStack = new MyStack(5);
for(x=0; x<5; x++)
{
System.out.println("\nEnter a number(Push): ");
input = num.nextInt();
theStack.push(input);
}
System.out.print("The first element on the top is the top of the stack");
System.out.println("");
while (!theStack.isEmpty()) {
long value = theStack.pop();
System.out.print(value);
System.out.println(" Pop");
}
System.out.println("");
}
}