Question: Create a Dynamic Array container with this user interface: // Gets the current number of entries in container int getCurrentSize() // Returns the current capacity

Create a "Dynamic Array" container with this user interface:

// Gets the current number of entries in container int getCurrentSize() // Returns the current capacity of the container int capacity()

// Checks whether the container is empty. boolean isEmpty()

// Adds a new entry to the container boolean insert(newEntry)

// Removes an entry from the container and moves all entries above anEntry down one boolean remove(anEntry)

// Get index value int getValue(index) // Removes all entries from the container void clear()

// Resize a container by doubling current capacity int resize() * Implement dynamic resizing using this algorithm:

1. Starting with a dynamic size of 10, if the number of elements exceed this number:

a. Reallocate the container size to double the current size

b. Move the contents of the current container to the newly sized container

c. Delete the previously sized container.

Resize C++

Data* ptemp = new Data[capacity*2 ]; for (int i=0; i 
2. Repeat from step 1a. as necessary. 3. Note the data file called "Words.TXT" is in the documents folder for this week. 4. Read the data file and store the words in the dynamic array. 

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!