Please read the following requirements carefully and then implement your own customized Array class:
provide the following features:
Two constructors. One takes the input of the initialized capacity (int) and create the underlying array with that capacity; the other takes no input and creates an array that can hold a single element by default (that is, init capacity == 1);
Getters and setters and basic methods we discussed during the class including: getCapacity(), getSize(), set(int index), get(int index), isEmpty();
CRUD operations we discussed during the class including: add(int index), addLast(), addFirst(), remove(int index), removeLast(), removeFirst(), removeElement(int target), removeAll(int target);
Supports generic types;
Mutable, that is when add element exceeding its capacity, it can resize to accommodate the change.
Implement a (private or public) swap(int a, int b) method that swaps the two elements in the index a and b if a and b are both admissible; also a public reverse() method that reverses the order of stored elements in-place (means, no additional spaces are allocated).
A public void sort() method sorts the stored elements in ascending order inO(nlog(n)) time.
[hint]:
Quicksort or
Merge sort