A multimap is data structure that allows for multiple values to be associated with the same key.
Question:
A multimap is data structure that allows for multiple values to be associated with the same key. It has a put(k, v) method, which inserts an item with key k and value v even if there is already an item with key k (but not the same key-value pair), and a FindAll(k) method, which returns all the values that have the key k. Describe a scheme that implements a multimap so that the put(k, v) method runs in O(1) expected time and the FindAll(k) method runs in O(1 + s) time, where s is the number of values with key k.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Algorithm Design And Applications
ISBN: 9781118335918
1st Edition
Authors: Michael T. Goodrich, Roberto Tamassia
Question Posted: