Task 1

Update the solution to the Vector<> class 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 and shuffling elements 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;

Task 2

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.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be 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 complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.