Question: Provide an abstract data type PB that can be used to represent sequences of phone book entries regardless of the implementation. PB will be a
Provide an abstract data type PB that can be used to represent sequences of phone book entries regardless of the implementation. PB will be a sequence of objects of class Person that is a tuple (String personID, String phoneNum).
The ADT PB must support the following operations:
int size() - return the current size of the sequence.
void add(int i, Person person) add a new component before the i-th component of the sequence (using 0 for the index of the first component). (when the sequence has fewer than i components, insert the new element at the end of the sequence)
Person delete(int i) - Remove the i-th component of the sequence and return the object removed (in case when the sequence has fewer than i components, do nothing and return null).
Person find(int i) Return the i-th component of the sequence (raise an exception if the sequence has fewer than i components).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
