Question: Hello, I am taking a Data Structures and Algorithms class in Java and we were just introduced to Stacks and Queues. In the first part

Hello,

I am taking a Data Structures and Algorithms class in Java and we were just introduced to Stacks and Queues. In the first part of the assignment we are asked to create a Deque which I do not really know how to implement. I have attached the description of the problem and a note from the instructor. Also, comments would be appreciated!

Thanks!

Hello, I am taking a Data Structures and Algorithms class in Java

Note from Instructor:

Your class Deque in Assignment 2 should look like this:

class Deque

{

private int maxSize;

private long[] dekArray;

private int left;

private int right;

private int nItems;

//--------------------------------------------------------------

public Deque(int s) // constructor

{

maxSize = s;

dekArray = new long[maxSize];

int center = maxSize/2 - 1;

left = center+1; // left and right

right = center; // start out "crossed"

nItems = 0;

}

// other methods

}

Create a Deque class based on the discussion of deques (double-ended queues). It should include insertLeft (),insertRight ),removeLeft ), removeRight ), peekRighto, peekLeft ), isEmpty (),andisFull ) methods. It will need to support wraparound at the end of the array, as queues do. Write a driver class Deque App to test class Deque 1. eektleft 0): 1sss Desauichs.te

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!