Что такое большая нотация для этого кода ниже. Я все еще не мог полностью понять концепцию. Я должен задуматься от опытных кодеров, чтобы дать резюме для большой производительности, основанной на этом коде.Java Stack array - Big O notation
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("");
}
}
Класс не обладает большой сложностью. Какой у Вас вопрос? –