Build a key-value data structure which can perform following 2 functions
- lookup
- lookup
- rangeLookup(key1, key2)
-----------------------------------------------------------------------
We can implement it by using a combination
of HashMap and BST. HashMap will contain entry for key-value pair and BST only keys. All keys will be maintained in BST (sorted order).
lookup(Key): Make a simple lookup in to HashMap
rangeLookup() - It will be in two parts -
Keys[] rage(Key1, Key 2) from BST
Entry[] lookups(Keys[]) in HashMap

本文介绍了一种结合HashMap和BST的数据结构实现方案,该结构支持快速查找和区间查找功能。通过HashMap存储键值对,利用BST维护键的有序性。
1413

被折叠的 条评论
为什么被折叠?



