1- given the definition of the class 'StackArray' to implement a stack using arrays. Complete the implementation of methods- push, pop, and peek. public class StackArray { int[] s=new int[5];...


1- given the definition of the class 'StackArray' to implement a stack using arrays. Complete the implementation of methods- push, pop, and peek.



public class StackArray {


int[] s=new int[5];


int top=-1;


public boolean isempty( ){


return top == -1;


}


public boolean isfull( ){


return top == s.length-1;


}



 public void push(int e) {


}


 public int pop( ) {


}


 public int peek( ) {


}


}


2- Write Java code to:


a: Create a Deque object containing all integers from 1 to 20.


b: Display the front and rear elements


c: Display all elements in reverse order.




Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here