Question
In this task, you will define circular linked list data structure, and then further modify it to work as a circular buffer. Problem Description: A
In this task, you will define circular linked list data structure, and then further modify it to work as a circular buffer.
Problem Description:
A circular linked list is a list that has no end or beginning; the tail node points to the head node, creating a loop of nodes. Such a data structure can be useful in storing the points of a polygon, for example, or for creating a circular buffer that stores data items that must be processed in some way e.g. jobs to be serviced in a first-in-first-out fashion.
In the buffer application, nodes are added from one end of the buffer and removed from the other end. Every time a node is removed, the buffer has one more empty slot. And every time a node is inserted, the buffer has one less empty slot. Insertion and deletion must check the status of the buffer (empty/full)
A circular linked list works extremely well to implement a circular buffer. Once the buffer is allocated (in the class constructor), no additional space needs to be allocated for the structure. Additionally, the buffer only needs to add an item to store for processing, remove an item to process it, and optionally return the size or status of the buffer. All of these operations can easily be done in constant time using the circular linked list.
In this assignment, you are to define a class that that can be used as a circular buffer structure
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