Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Figure 4.8 shows the linked list implementation, named LList. LList inherits from abstract class List and so must implement all of the member functions of

Figure 4.8 shows the linked list implementation, named LList. LList inherits from abstract class List and so must implement all of the member functions of List (Figure 4.1).

image text in transcribed

A circular linked list is one in which the next field for the last link node of the list points to the first link node of the list. This can be useful when you wish to have a relative positioning for elements, but no concept of an absolute first or last position.

a)Modify the code of Figure 4.8 to implement circular singly linked lists.

image text in transcribed

image text in transcribed

template class List // List ADT private void operator = (const List&) List (const List&) // Protect assignment // Protect copy constructor {} public / Default constructor List) virtual List) // Base destructor // Clear contents from the list, to make it empty virtual void clear 0; / Insert an element at the current location // item: The element to be inserted virtual void insert (const E& item)0; // Append an element at the end of the list // item: The element to be appended virtual void append(const E& item) = 0; / Remove and return the current element / Return: the element that was removed virtual E remove() 0; // Set the current position to the start of the list virtual void moveToStart )0 /l Set the current position to the end of the list virtual void moveToEnd) 0; // Move the current position one step left. No change // if already at beginning virtual void prev() 0; // Move the current position one step right. No change // if already at end virtual void next ) 0; // Return: The number of elements in the list virtual int length ) const 0; // Return: The position of the current element. virtual int currPos ) const0 // Set current position // pos The position to make current virtual void moveToPos (int pos)0 / Return: The current element. virtual const E& getValue ) const0; Figure 4.1 The ADT for a list

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

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

b. Will new members be welcomed?

Answered: 1 week ago

Question

c. Will leaders rotate periodically?

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago