Question: Implement the vector ADT by means of an extendable array (expands dynamically) used in a circular fashion, so that insertions and deletions at the beginning

Implement the vector ADT by means of an extendable array (expands dynamically) used in a circular fashion, so that insertions and deletions at the beginning and end-run in constant time.

Print the circular array before and after each insertion and deletion.

Insertions and deletions that are not at the beginning or end will run in O(n) time.

Test the vector ADT methods (inserts, deletes, size, isEmpty, etc.)

Do not use the STL.

Perform the following operations using the circularqueue.

Assume the array size is 4.

Show the index (rank) of the array elements with the corresponding values.

insert(0,1)

insert(0,2)

insert(0,3)

insert(0,4)

insert(0,7)

isEmpty()

insert(0,4)

at(1)

insert(2,2)

at(2)

erase(1)

insert(1,5)

insert(1,3)

insert(4,9)

at(2)

set(3,8)

size()

Coding Language: c++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!