Hash tables v self-balancing search trees

后端 未结 6 2087
北恋
北恋 2021-02-05 10:34

I am curious to know what is the reasoning that could overweighs towards using a self-balancing tree technique to store items than using a hash table.

I see that hash

6条回答
  •  梦如初夏
    2021-02-05 11:20

    In my humble opinion, self-balancing trees work pretty well as Academic topics. And I do not know anything that can be qualified as a "straight-forward implementation of a red-black tree".

    In the real world, the memory wall makes them far less efficient than they are on paper.

    With this in mind, hash tables are decent alternatives, especially if you don't practice them the Academic style (forget about the table size constraint and you magically resolve the table resize issue and almost all collision issues).

    In a word: keep it simple. If that's simple for you then that's simple for your computer.

提交回复
热议问题