开发者

Table Data Structure Other than hashtable?

I was reading this wikipedia page http://en.wikipedia.org/wiki/Hash_table There I fount this line The main advantage of hash tables over other table data structures is speed. ...

My question is what are the other table d开发者_C百科ata structure then hast table ?


Trees, lists, stacks, queues, graphs, tries, and skip lists are other data structures that come to mind. Is that what you're asking?

UPDATE:

I'm assuming that table means "key, value" pair to you, so a dictionary or map would qualify as a table.

A tree can be used to implement a Map.

You can also use a pair of lists: one for the key, the other for the values.

If you write a Map.Entry class that combines together a key and a value you can store it in any data structure you wish, including the list, queue or stack. The read and write characteristics might not be what you had in mind in those cases.

The point is that there's an abstract data type whose behavior represents what you think of when you want "table". The implementation can be completely separate. The interface doesn't change if I choose an underlying data structure that is a good "table" or not.

Each one has a different Big-Oh characteristic for read and write.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜