Suppose you are working for a victim-support group to build a website for maintaining a set, S,
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 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 Answer:
Algorithm Design And Applications
ISBN: 9781118335918
1st Edition
Authors: Michael T. Goodrich, Roberto Tamassia