Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago