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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started