Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this picture for help if you need any. Assignment 5 Write a program in C++ that implements the Doubly Linked List using OOP concepts without

image text in transcribed

this picture for help if you need any.

image text in transcribed

image text in transcribed

image text in transcribed

Assignment 5 Write a program in C++ that implements the Doubly Linked List using OOP concepts without using sentinels (dummy nodes, implemented in Book section 3.3). The element type should be of type int. Book implementation: Your implementation: You must submit in total 5 files, 4 for coding and 1 pdf file with the explanation. This assignment has four parts: 1- Write a classew type) to define a Node, you can name it DNode (only class definition, see the book on page 125 ). 2- Write a class to implement the Doubly Linked List without dummy nodes. You can name it DLinkedList (class definition and class implementation in separate files, see the book on pages 126128 ). 3- Implement the Main function (in a separate file .cpp file) 4- Test DLinkedList operations in the main function You must submit in total 5 files, 4 for coding and 1 pdf flle with the explanation. 1. DNode class Member variables: - int elem; // data - DNode * prev;//pointer to the previous node - DNode "next;//pointer to the next node Member functions: - No member functions Access type - Private Member functions: - DLinkedList!/; - 2 DLinkedList hi// destructor - bool emptyl] const; // is list ermpty? - const int\& front (j const; // get front element - const int & back(j) const; // get front element - void addFronticonst int \& e); // add to front of list - void addBack(conist int \& e): // add to back of list. - void removefront(0; // remove front item from list - void removeBack(); // remove back item from list - void printiconst bool\& front = True); // prints starting from the head when the parameter front value is true, and prints starting from the trailer when the parameter front value is false. It is up to you if you want to implement the DLinkedList class using add and remove methods below. You can decide to implement the addFront, addBack, removeFront, and removeBack without using these two methods]. - void add(DNode*, const int \&); 3. Main Write the main function in a separate file. 4. Test DLinkedList operations in the main function Include DLinkedList.h in main.cpp file Inside the main function: Create an object of type DLinkedList. Add 3 items from the front and 2 items from the back. Print it starting from the head. Print it starting from the trailer. Remove one item from the front and one item from the back. Print it starting from the head. Print it starting from the trailer. Add 1 item from the front and 1 item from the back. Print it starting from the head. Print it starting from the trailer

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

Database Publishing With Filemaker Pro On The Web

Authors: Maria Langer

1st Edition

0201696657, 978-0201696653

More Books

Students also viewed these Databases questions