Please see the general programming webpage for details about the programming environment for this course, guidelines for programming style, and details on electronic submission of assignments.
The only file you will need for this assignment is the Vector.h file that we wrote in class.
For this assignment, you must work alone on your assignment.
Please make sure you adhere to the policies on academic integrity in this regard.
As you may have noticed, the vector class in C++ has much less functionality than the list class in Python. In addition, we did not even complete all of the vector functionality that is included in the standard template library.
In as effort to ``upgrade" the vector class we wrote, you will write the following functions described below in our Vector.h file. (Please download Vector.h from the course schedule webpage and insert your functions into this class, then submit the entire Vector.h file via email by the due date.)
Removes the earlist occurance of val present in the vector. Note that this changes the size.
This is actually the same as our current erase function, expect for one difference. You will rewrite the function erase from our implementation of vectors so that if the number of elements gets below capacity/4, you shrink the array size by half. If this happens, all the elements copied into a new array of the appropriate size.
Resizes the vector to contain sz elements.
If sz is smaller than the current vector size, the content is reduced to its first sz elements, the rest being dropped.
If sz is greater than the current vector size, the content is expanded by inserting at the end as many copies of c as needed to reach a size of sz elements. This may cause a reallocation.
Notice that this function changes the actual content of the vector by inserting or erasing elements from the vector; it does not only change its storage capacity.
Source Code
Submit your revised Vector.h file.
Test file
Submit your revised testVector.cpp file.
"readme" file
An overview of your
final product (including comments on how you tested your code), and the
runtime analysis for each function you code.
The assignment is worth 10 points, with points assigned based on your implementation, test file, and readme.