For this task you are required to update the solution to the Vector<> class from the Week 3 practical as follows:
Rename the Vector<> class to OrderedArray<>;
Data must be stored in sorted order;
No linear searching or sorting is permitted, the binary search (Workbook Section 8.1.2) and shuffling elements (Workbook Section 1.6.1) in the array must be used instead;
You must implement the IList<> interface, requiring the following additional members:
public int IndexOf(TYPE item) – returns the index where item is found or -1 if the item is not found;
public void Insert(int index, TYPE item) – throws a NotSupportedException;
public void RemoveAt(int index) – throws an ArgumentOutOfRangeException if the index is out of bounds, otherwise removes the element stored at the specified index;
public void CopyTo(TYPE array, int arrayIndex) – throws an ArgumentNullException if array is null, throws an ArgumentOutOfRangeException if arrayIndex is negative, throws an ArgumentException if there is not enough space remaining in the destination array to store all the elements, otherwise copies the stored data to the destination array;
public bool IsReadOnly – returns false;
public bool Remove(TYPE item) – removes the specified data if found and returns true, otherwise returns false;
You must implement an additional method public void Change(TYPE oldValue, TYPE newValue) which replaces the specified oldValue with the specified newValue, maintaining the order in the array;
For this task you are required to create a new generic collection HashedList<> which stores data in a hash table declared as follows:
private List _HashTable;
The HashedList<> collection must implement the following members:
public HashedList(int hashTableSize) – constructor which receives initialises the collection using the specified size for the hash table;
public void Add(TYPE data) – stores the specified data into the hash table by using data.GetHashCode() for the hash value and applying modulo division (note that GetHashCode() is provided by Microsoft.Net, you don’t need to write this);
public bool Contains(TYPE data) – applies the same hashing technique for the Add method to determine the correct entry in the hash table array then returns true if the data is stored in that hash table entry, otherwise returns false;
public void Change(TYPE oldValue, TYPE newValue) – replaces the specified oldValue with the specified newValue, maintaining the integrity of the hash table; and
Members as required to implement the IEnumerable<> interface.
It is not our intention to break the school's academic policy. Projects posted are only used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly fill out the form.
Please provide a valid email address and we'll get back to you in less than 24 hours.
We will be sending an invoice through PayPal upon confirmation.
We are a non profit organization however we need an amount to keep this organization running,
and to be able to complete our research and development.