In this assignment you will implement a dynamic array


In this assignment, you will implement a dynamic array. Dynamic arrays provide all the advantages of static arrays--random access, sequential access, compactness-plus the capability to change size.

Static arrays are high-performing data structures with little overhead.  Because array elements are stored in contiguous memory, indexing and iteration are fast; insertion and removal of array elements, however, requires shifting the remaining elements.

Dynamic arrays wrap a static array divided into two parts:  a used part storing the actual elements; an unused part reserved for new elements.  The number of elements used by the dynamic array is referred to as its size; the length of the underlying static array is referred to as its capacity.

As elements are added to the end or middle of the dynamic array, its size grows.  When the array's size equals its capacity, the dynamic array must be resized.  Resizing a dynamic array requires that a new array be allocated and that the original elements be copied into the new array.  Dynamic arrays are usually resized by a large amount, referred to as the growth factor, to minimize the cost of resizing:  allocating a new array and copying the existing elements.

The C++ vector class in the Standard Template Library is an example of a dynamic array. Internally, vectors use a dynamically allocated array to store elements. Elements are accessed by their position in the underlying array.

Attachment:- Assignment.zip

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: In this assignment you will implement a dynamic array
Reference No:- TGS02205571

Expected delivery within 24 Hours