Question
I need to implement raw array Stack for create empty stack, isEmpty, isFull, push, pop, and size using below pseudo code. I need two classes
I need to implement raw array Stack for create empty stack, isEmpty, isFull, push, pop, and size using below pseudo code. I need two classes with stack pseudo code implementation and the main method to demonstrate the correct working of each operation.
pseudo code
StackADT (using raw array)
class StackADT {
int top
int items[]
int max
StackADT(int n)
Initialize array to n capacity
top = 0
max = n
boolean isEmpty()
if array has no elements return true else return false
boolean isFull() {
if array is full return true else return false
void push(int item)
if (isFull()) throw exception
add item to items[top] increment top
int pop()
if (isEmpty()) throw exception
decrement top
return top element from array
int size()
return number of elements
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started