Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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_2

Step: 3

blur-text-image_3

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

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions