Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ . [40 marks] (Deque) A deque is a data structure consisting of a list of items on which the following operations are possible

IN C++

image text in transcribed

. [40 marks] (Deque) A deque is a data structure consisting of a list of items on which the following operations are possible a. push (x): Insert item x on the front end of the deque. b. pop ): Remove the front item from the deque and return it. c. inject (x) Insert item x on the rear end of the deque. d. eject Remove the rear item from the deque and return it. Write routines to support the deque that take O(1) time per operation (the operations that take O(n) will be given 0 point). Write an application file a2q3.cpp containing main) function to test if Deque class works correctly. Three files should be submitted for this program question. 1) the file Deque.h which contains the definition and implementation of Deque class template, 2) the application file a2q3.cpp containing main) function, 3) a script file a2q3result containing result. Here are the sample runs: Push values in deque: 1 234 5 Inject values in deque: 1 234 5 The front element popped out is 5 The rear element ejected out is 5 The front element popped out is 4 The rear element ejected out is 4 . [40 marks] (Deque) A deque is a data structure consisting of a list of items on which the following operations are possible a. push (x): Insert item x on the front end of the deque. b. pop ): Remove the front item from the deque and return it. c. inject (x) Insert item x on the rear end of the deque. d. eject Remove the rear item from the deque and return it. Write routines to support the deque that take O(1) time per operation (the operations that take O(n) will be given 0 point). Write an application file a2q3.cpp containing main) function to test if Deque class works correctly. Three files should be submitted for this program question. 1) the file Deque.h which contains the definition and implementation of Deque class template, 2) the application file a2q3.cpp containing main) function, 3) a script file a2q3result containing result. Here are the sample runs: Push values in deque: 1 234 5 Inject values in deque: 1 234 5 The front element popped out is 5 The rear element ejected out is 5 The front element popped out is 4 The rear element ejected out is 4

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions

Question

define the term outplacement

Answered: 1 week ago

Question

describe the services that an outplacement consultancy may provide.

Answered: 1 week ago