eriklukeyale
BAN USER- 0 Answers Fast way to store employee objects via zip code lookup.
Ok so you have a hash map of employees keyed off a unique key of employee id. But you also want to be able to answer a question which is give me all employees that have the zip code XXXXX, or whatever. What is a fast way to do this? Keep in mind that when you insert/update/delete employees into this hashmap you must also manage any other data structure you have so that the zipcode index is balanced and accurate.
- eriklukeyale March 24, 2015
I had proposed to use another hashmap, where the key is the zip and the value is a linkedlist of pointers to the employees in the employee hashmap, but this becomes O(n) for insert/delete and lookup because you have to walk the entire list of elements in the linked list in the zipcode hashmap. Can we do better, any ideas on making this a faster index, lookup and make sure its balanced? Thanks| Flag | PURGE - 0 Answers Given 5 horses or runners and 10 sensors return top runners
Basically you have 5 horses running. There are 10 sensors spread out over the race. You want the ability to ask what are the 5 fastest horses in order and do so in the fastest way. How would you construct the data structures in order to return the top fastest running horses? Should minimize overhead and be as fast as possible to return the top in order. Any ideas? Thanks.
- eriklukeyale March 24, 2015| Flag | PURGE