Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, we will build a self-adjusting list. A self-adjusting list is one which will rearrange itself after operations. When creating a self-adjusting list,

For this assignment, we will build a self-adjusting list. A self-adjusting list is one which will rearrange itself after operations. When creating a self-adjusting list, it can be approached in a few different ways. For this assignment we will move elements to the head (start) of the list. This is called Move-To-Front (MTF). Self-adjusting lists have a wide range of uses, consider a cache. The most recently accessed item is moved to the front so it can be found again quickly. Specifications

You will implement a self-adjusting list (self_adjusting_array.h)

Self-adjusting list operations:

a. In a self-adjusting list, all insertions are performed at the front.

b. A self-adjusting list has a find operation, and when an element is accessed by a find, it is moved to the front of the list without changing the relative order of the other items.

c. NOTE: You will need extensive test cases to show these operations work as expected. Because the items are not sorted you will have to use a basic linear search to find the item. DO NOT assume the item for which you are looking is in the list.

Write a main method which shows all operations of your lists are working as expected. Include a foreach loop so you can show the iterators work as expected and the find operation does in fact change the ordering of the elements.

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

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

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions