Consider the dynamic version of the RecordDB class just described. While we want to increase the size of the array of records sufficiently on an "as needed" basis, we don't want to waste too much memory either. Memory may be wasted in a situation in which we have lots of insertions followed by lots of deletions. For example, suppose that we start with an array of size 1, and insert 1000 records into the array. At this point the array size is 1024. Now suppose that we have a sequence of 900 deletions. Now we have an array of 1024 slots in which only 100 slots are occupied and more than 90% of the allocated memory is unused. To deal with this problem, we should modify the delete method in the RecordDB class. Specifically, the delete method should check (after deleting a record) if the number of occupied slots is fewer than half the size of the array. If so, the array size should be shrunk to half its current size.
Make the modification mentioned above to the delete method in the DynamicRecordDB class and place DynamicRecordDB.java in the dropbox for quiz2 by end of class time.