Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions

Question

What are some of the possible scenes from our future?

Answered: 1 week ago