Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

***NEEDS TO BE DONE IN C++ NOT JAVA*** TITLE EXERCISING A DOUBLY-LINKED LIST CLA

ID: 3564148 • Letter: #

Question

***NEEDS TO BE DONE IN C++ NOT JAVA***

TITLE

EXERCISING A DOUBLY-LINKED LIST CLASS

INTRODUCTION

This project consists of two parts, the second of which appears below. For the first part, write a class that implements an unordered list abstract data type using a doubly-linked list with pointers to both its first and last nodes. The second part of the project specifies a client program that uses the class.

DESCRIPTION

Write a class that implements an unordered list ADT. This class should provide the following operations:

Implement the unordered-list ADT using a doubly-linked list with pointers to both its first and last nodes, as in this figure:

In the class that implements the list ADT as a doubly-linked list, include two data members: a pointer to the first node in the list, and a pointer to the last node in the list. Note that the pointer to the list's last node makes both append() and remove_last() fast. Thus the class's data members will be something like this:

You may want to write a program with which to test this class.

Here's something to do with the unordered-list implementation:

DESCRIPTION

Consider this line-editing problem: A program reads characters one at a time, then prints them back to the terminal in order. However, the character `#' is not to be saved. Rather, it indicates that the program is to delete the most recent character. After reading reaches the end of the line, the surviving characters are printed in forward order. For example:

Write a program that uses the unordered-list implementation to solve the editing problem just described. Use a doubly-linked list, provided by the class, to hold the characters of the input line in the order in which they are entered.

INPUT

The program reads a line of characters, any number of which may be the delete character `#'.

OUTPUT

The program prints the surviving (non-deleted) characters from the input, in the order in which they appeared.

ERRORS

The program may assume that the input is as described; it need not detect any errors.

EXAMPLE

A run of the program might look like this:

and another might look like this:

HINTS

The Item type in the unordered list class is char.

For the client program, recall that the function get() reads the next character from the named input stream into the function's parameter, which is passed by reference. Example: cin.get(ch);

TESTING

Pay particular attention to verifying that your program works as it should. Plan and describe your tests carefully, and be sure to test novel cases like empty strings, strings that delete more than all their printable characters, and strings that contain no delete characters.

***NEEDS TO BE DONE IN C++ NOT JAVA***

input: abcd##ef => output: abef TITLE EXERCISING A DOUBLY-LINKED LIST CLASS INTRODUCTION This project consists of two parts, the second of which appears below. For the first part, write a class that implements an unordered list abstract data type using a doubly-linked list with pointers to both its first and last nodes. The second part of the project specifies a client program that uses the class. DESCRIPTION Write a class that implements an unordered list ADT. This class should provide the following operations: A default constructor that initializes a newly declared list to be empty. A destructor that deletes all the nodes in a list. empty(), a boolean function that reports if the list that invokes it is empty. append(entry), which appends the item entry at the end of the list. remove_last(), which removes the last item from the list. An output function that prints the list in forward order to an output stream; you may assume that

Explanation / Answer

#include usingnamespace std; struct node { int data; node *next; node *prev; }; void addnode(); void delnode(); void display(); void show(); void search(); node *start=NULL, *temp1, *temp2, *temp3; int main() { char ch; do { char i; cout