Question: Assignment: Use your LinkList class as a starting point to make a class CircList . It will be a singly linked Circular List that has

 Assignment: Use your LinkList class as a starting point to make

Assignment:

Use your LinkList class as a starting point to make a class CircList.

It will be a singly linked Circular List that has no end and no beginning.

The only access to the list is a single reference, current, that can point to any link on the list.

This reference can move around the list as needed.

The CircList class should have the following methods:

bool search(int valueToFind)

Return true if any Link has iData == valueToFind

void insertInitialLink(int newValue)

Inserts a new Link that has iData = newValue

void insertAfterValueFound(int newValue, int valueToFind)

Inserts a new Link that has iData = newValue

Inserts After the first Link which has valueToFind

Does not insert if valueToFind is not found

bool deleteLink(int valueToFind)

Deletes the first Link which has iData == valueToFind

Returns true upon successful deletion, false otherwise

void displayList( )

Displays the list

Youll need to break the circle at some arbitrary point to print it on the screen*.

You may find it convenient if delete operation takes place one link downstream of the link pointed to by current. (Because the upstream link is singly linked, you cant get at it without going all the way around the circle.)

[ *Hint: You can use count and numLinks variables in the LinkList class, to check through how many links you have moved. If count == numLinks-1 ? then you have gone through the entire list]

There are many ways to design a circular list. This is one of them #include data = value) return true; current current->next ; = return false void displayList(C 34 35 36 37 38 39 40 41 42 43 cout show(); current current->next; else cout next = newLink; numLinks++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!