Reference no: EM13350461
Task 1
For your first task, you will prepare sorted versions of the Linked Lists and Vector data structures developed in class. The easiest way to accomplish this is to derive sorted versions of Vector and Linked List and alter their add methods so that they always place values in the correct location.
For an extra challenge, try creating a single class that accepts any generic Indexed class as a parameter (this is what I did) that handles the extra sorting logic.
Task 2
For this task you must add methods that add input and output flexibility to the Vector and LinkedList classes:
Constructors that accept a reference to another indexed collection
The goal of this additional constructor is to convert between indexed collections. For example, this constructor will allow you to use an existing LinkedList's data as the foundation of a newly created Vector.
Constructor that accepts a basic C-style array
The goal of this constructor is to convert an existing C-style array into one of our more powerful data structures. This constructor should have two parameters: A pointer to the array, and an integer indicating the number of items in the array.
Method that converts the data structure into a C-style array
The goal of this function is to convert our more powerful data structures back into a basic C-style array. Note that this method should return a pointer to a newly created dynamic array.