Lab 1: Vector


Rate this product

EECS 330 Lab 1: Vector
Get familiar with vector implementation with C++.
Specification of the ADT
• Implement a vector data structure with the basic interface and methods.
• Implement an iterator class that supports the traverse of your vector data structure.
Hint: for many methods, you can refer to the code available in Figure 3.7 and Figure 3.8 of the textbook (Data
Structures and Algorithm Analysis in C++ by Mark Weiss, 4th Edition).
Additional Requirements:
1. Rename the object name into “MyVector”, instead of “vector” as indicated in the textbook.
2. Your object should contain a copy constructor that supports initialization from an STL vector. The
constructor should have an interface of MyVector(const std::vector<Object>& rhs).
3. Implement an “append” method, which appends all data elements in the parameter (as rvalue) to
the current object. The return value should be the current object. The function has an interface of
MyVector<Object>& append(MyVector<Object> && rhs).
Testing and Grading
We will test your implementation using the tester main function posted online. The posted input and output
examples should be used for a testing purpose, while we will use another set of inputs for grading. Your
code will be compiled under Ubuntu 20.04 LTS using g++ version 9.3.0 (default) with C++11 standard.
Your final score will be the determined by the success percentage of your program when fed with many
random inputs. Note that if your code does not compile (together with our tester main function), you will
receive 0. Therefore, it is very important that you ensure your implementation can be successfully compiled
before submission.
Submission and Deadline
Please submit your implementation as a single .h file, with a file name “MyVector_[YourKUID].h”. For
example, if my KU ID is c123z456, my submission will be a single file named “MyVector_c124z456.h”.
Submissions that do not comply with the naming specification will not be graded. All submission will go
through Blackboard. The deadline is Friday Feb 17th, 2023, 11:59PM.

Scroll to Top