Question: Suppose you are working for a victim-support group to build a website for maintaining a set, S, containing the names of all the registered sex

Suppose you are working for a victim-support group to build a website for maintaining a set, S, containing the names of all the registered sex offenders in a given area. The system should be able to list out the names of the people in S ordered by their Zip codes, and, within each Zip code, ordered alphabetically. It should also be able to list out the names of the people in S just for a given Zip code. The running time for a full listing should be O(n), where n is the number of people in S, and the running time for a listing for a given Zip code should be O(log n+s), where s is the number of names returned. Insertions and removals from S should run in O(log n) time. Describe a scheme for achieving these bounds.

Step by Step Solution

3.43 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Store the elements from S in a balanced binary search tree T ordered by a combination of Z... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Data Structures Algorithms Questions!