Data Structure using C++, Circularly doubly-linked lists with a sentinel node

Data Structure using C++, Circularly doubly-linked lists with a sentinel node

Homework 3:

Build and process a sorted linked list. Rewrite the first homework assignment(attached below) according to the following specifications (you can also see these specifications in the PDF file). (DO NOT USE VECTOR LIBRARY AS NOT USED IN THE FIRST ASSIGNMENT.)

A. Reads data from a text file (mountains.txt) and inserts them into a circularly sorted doubly-linked list with a sentinel node. The list is to be sorted in ascending order by the mountain name named name (a unique key). The Mountain class has four data members:

name (string) elevation (int) range(string) state (string)

B. Prints the list as a table with four columns (header included) in ascending order.
C. Prints the list as a table with four columns (header included) in descending order.

D. Prints the number of items in the list.

E. Searches the list: prompts the user to enter the name of the mountain or QUIT to stop searching; searches for that name: if found, displays its’ data, otherwise displays some message, such as “… Not found”

F. Deletes nodes from the list: prompts the user to enter the name of the mountain to be deleted from the list or QUIT to stop deleting.

G. Prints the number of items in the list.
H. Prints the list as a table with four columns (header included)
I. Prints the list as a table with four columns (header included) in descending order.
J. Destroys the list //no memory leak

Note:

The first assignment attached below has some problems, so please first fix them before doing the homework 3 based on the comments below:

~*~==============================================~*~~

Improved displayList()

The header does not match with the printed table

-3Points
~*~==============================================~*~~
Define a constructor for the Mountain class too, to make the MountainList class constructor simpler.

MountainList::MountainList()
{
head = new ListNode; // head points to the sentinel node

head->mount.set_elevation();
head->mount.set_name();
head->mount.set_range();
head->mount.set_state();

head->next = NULL;
count = 0;
}

// See below

MountainList::MountainList()
{
head = new ListNode;
head->next = NULL;
count = 0;
}

Mountain::Mountain() {
elevation = 0;
name = “”;
range = “”;
state = “”;
}

-1Point
~*~=======================================~*~~
SEARCH:

Achieving a Better Solution // See Chapter 1
– Cohesive modules perform single well-defined tasks
– Coupling – measure of dependence among modules
– Loosely coupled modules desired

Cohesion: keep one task per function: search and nothing else.
No printing: all cout statements should be removed and
the header of the function should be updated

// See below

bool searchList(string, Mountain &) const;

// In search manager
1. call search
2. if not found, print a message, otherwise print related data

-2Points
~*~==============================================~*~~
SEARCH

The list is sorted… search should not go through
the entire list if target is not found. For instance:

list: 10 20 30 40 50 60 70 80 90
target: 25

stop searching at 30!

-2Points
~*~==============================================~*~~
DELETE

When searching for the node to be deleted from the list
do not go through the entire list if target is not found.
For instance:

list: 10 20 30 40 50 60 70 80 90
target: 25

stop searching at 30!

-2Points
~*~==============================================~*~~

1. Download the two files attached: “FirstAssignmet.zip” and “_22C_Hw3.pdf”

2. Fix issues on the FirstAssignment based on the comments that I wrote above.

3. Read CAREFULLY _22C_Hw3.pdf, and start working on homework 3.

4. Before submit here, all requirements must meet as in the PDF and the comments, so please check again thoroughly.

5. Submit within the given time. (Very Important)

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper