Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE FOLLOW THE INSTRUCTIONS AND DEFINE THE ONES IN THE PICTURE AS WELL AS SIMPLE AS POSSIBLE. AND PLEASE DO NOT USE DUMMY NODE AND

image text in transcribedimage text in transcribedimage text in transcribed

PLEASE FOLLOW THE INSTRUCTIONS AND DEFINE THE ONES IN THE PICTURE AS WELL AS SIMPLE AS POSSIBLE. AND PLEASE DO NOT USE DUMMY NODE AND MAKE SURE IT IS EXACTLY THE SAME AS THE PICTURE. PLEASE EXPLAIN STEP BY STEP AS WELL.

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 RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions