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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started