Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

We will define a ring to be sorted bi-directional circular list that is implemented using links. Each node in the ring will have a backward

We will define a ring to be sorted bi-directional circular list that is implemented using links. Each node in the ring will have a backward and forward link and a data entry. The ring will be sorted in ascending order following the forward links. Of course, since the ring is circular, there is a discontinuity in the sort at the head (the start/end point) of the ring. Create a templated ring class along with functions for inserting and deleting data, and a function that displays the contents of the ring. You must use the LinkedSortedList ADT from our textbook as the base code for your solution. (See attached ZIP file.) You will need to update a few portions of the code so that it supports bi-directional linked lists. Write a driver that inserts 50 unique random ints into a ring, displays the ring in both forward and backward directions by following the links, and then deletes all of the odd values that were inserted. Perform the deletions by saving a list of the odd values (say, in a vector or array) and then using your delete function dont write a special function that traverses the ring, deleting odd values as it goes. Should your delete function follow the forward or backward links when deleting? Display the ring again in both forward and backwards directions after performing the deletions.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions