logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Jyanat KhuranaComputer science
(5/5)

600 Answers

Hire Me
expert
Jesse RosssEngineering
(5/5)

979 Answers

Hire Me
expert
Adele AndersonLaw
(5/5)

704 Answers

Hire Me
expert
Julian RichardsonnEconomics
(5/5)

604 Answers

Hire Me
C++ Programming

ChunkList is like a regular linked list, except each node contains a little fixed-size array of elements instead of just a single element.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

ChunkList

Original ChunkList concept by Nick Parlante. Adapted to an assignment by Varick Erickson.

1 INTRODUCTION

A ChunkList is like a regular linked list, except each node contains a little fixed-size array of elements instead of just a single element. Each node also contains its own "size" int to know how full it is.

The ChunkList will have the following features...

  • The ChunkList object contains a head pointer to the first chunk, a tail pointer to the last chunk, and an int to track the logical size of the whole When the size of the list is 0, the head and tail pointers are null.

 

next

*

 

next

*

 

next

*

 

next

null

len

8

len

1

len

2

len

5

values

4

values

9

values

10

values

2

2

 

12

7

5

 

 

0

4

 

 

-1

2

 

 

2

8

 

 

 

0

 

 

 

1

 

 

 

 

  • Each chunk contains a fixed size ItemT [] array, an int to track how full the chunk is, and a next pointer. There should be a constant ARRAY_SIZE = 8 that defines the fixed size of the array of each chunk. Elements should be added to the array starting at its 0 index. Elements in each little array should be kept in a contiguous block starting at 0 (this will require shifting elements around in the little array at times). You may want to test ARRAY_SIZE set to smaller values, but turn it in with ARRAY_SIZE set to

  • The empty collection should be implemented as null head and tail Only allocate chunks when actually needed.

  • ChunkList should implement the following methods:

  • Append(ItemT elem)

  • GetLength() → (refers to the total number of elements, not the number of chunk nodes)

  • GetIndex(int i) → (gets the item at index i)

  • Search(ItemT elem)

  • Print

  • Remove(ItemT elem) → (removes first instance of elem)

  • IsEmpty

  • The Append operation should add new elements at the end of the overall collection - i.e. new elements should go into the tail chunk. If the tail chunk is full, a new chunk should be added and become the new tail. We are not going to trouble ourselves shifting things around to use empty space in chunks in the middle of the

  • The Remove operation should look through each chunk array until the target element is Since the ChunkList can potentially have duplicates of the same elements, Remove should just delete the first found instance of the element. If the chunk node is empty after removing the element, then the entire chunk should be removed from the link list.

  • Do not use a dummy node because (a) it does not help the code much, and (b) dummy nodes are

  • Keep a single "len" variable for the whole list that stores the total number of client data elements stored in the list. Similarly, keep a separate “len” variable in each chunk to know how full it

  • Search should return a copy of the element if found. Otherwise it should return

 

2 TEST DRIVER

 

You should have a test driver similar to the list driver demonstrated in class. Much of this driver can be reused for testing your implementation of ChunkList. In particular, it should support the following commands:

  • Append

  • GetLength

  • GetIndex

  • Search

  • Print

  • Remove

  • IsEmpty

 

IMPORTANT: Be sure to craft your input tests to ensure that your node removal works correctly.

 

3  QUESTIONS

  1. What is the advantage of the ChunkList approach as opposed to the Unsorted link list implementation given in Chapter 3?

  2. What would be the implications of increasing the size of ARRAY_SIZE to a very large value?

  3. What is the big O of:

    • Append

    • GetLength

    • GetIndex

    • Search

    • Print

    • Remove

    • IsEmpty

 

  1. Compare placing a new element into the FIRST available empty space versus placing a new element in the tail chunk. What are the advantages and disadvantages to automatically placing values at the tail node?

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme