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 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started