Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use Doubly linked lists without dummy nodes in the most simplest way possible and please explain step by step what it does. language C++.

image text in transcribedimage text in transcribedimage text in transcribed

Please use Doubly linked lists without dummy nodes in the most simplest way possible and please explain step by step what it does. language C++. Thank you! ill give like.

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 1pdf file 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 2. DLinkedList class Member variables: - DNode * head; //pointer to the first node - DNode * trailer; //pointer to last node Member functions: - DLinkedList(); - DLinkedList ();// destructor - bool empty() const; // is list empty? - const int\& front() const; // get front element - const int \& back() const; // get front element - void addFront(const int \& e); // add to front of list - void addBack(const int \& e); // add to back of list - void removeFront(); // remove front item from list - void removeBack(); // remove back item from list - void print(const 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 \&); - void remove(DNode* ); Access type Member functions: - Public Member variables - Private Answer questions below before implementing DNode and DLinkedList class: Why member functions are public? Why data members are private? 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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

When is it appropriate to use a root cause analysis

Answered: 1 week ago

Question

Why does message development not begin with a creative idea?

Answered: 1 week ago

Question

What are the most important points to make in a creative brief?

Answered: 1 week ago