Skip to main content
8 events
when toggle format what by license comment
Oct 7, 2015 at 18:52 comment added JS1 @Jim OK I misread what you said earlier. If you need to look up a prefix using a code you do need a separate map that goes the other way.
Oct 7, 2015 at 18:01 comment added Jim I think it could store a value at the leaf node to act as a map but I will have only fast look up on the prefix. I won't be able to have fast look up on the code if it is in the value
Oct 7, 2015 at 0:00 comment added JS1 @Jim I think that searching a HashMap of 400 entries will take less than 1 millisecond on a mobile device, so it's probably not going to be worth it. A trie can be modified to store a value per key like a Map, so if you did use the trie, it could be used to retrieve a code from a prefix.
Oct 6, 2015 at 21:29 comment added Jim 1) The searches will be extremely few. But I am interested in speed nevertheless because the code will run in mobile device. 2) The 2 use cases is get the prefix having the code and breaking the input string to the prefix and the second part
Oct 6, 2015 at 21:05 comment added JS1 @Jim 1) For 400 entries, the performance benefit of a Trie would be small. Still, it depends on how many searches you plan on doing. If it is millions, you might want to try it. 2) You haven't shown the other use cases, so I don't know whether you still need the HashMap. You can use your Trie to search for key/value pairs.
Oct 6, 2015 at 20:33 comment added Jim Also I think that would mean that I would need 2 data structures in place. Both the hashmap and the trie, because I also need for other use cases the value in the hashmap given the code/key. Because I can't do that with the trie, right?
Oct 6, 2015 at 20:31 comment added Jim The hash table has at max 400 entries and the input string is not more than 11 character. Is there any actual benefit in implementing a trie (and testing it etc) for my specific input?
Oct 6, 2015 at 19:45 history answered JS1 CC BY-SA 3.0