Advantages of Binary Search Trees over Hash Tables

前端 未结 18 1124
醉酒成梦
醉酒成梦 2020-11-29 15:02

What are the advantages of binary search trees over hash tables?

Hash tables can look up any element in Theta(1) time and it is just as easy to add an element....but

18条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 15:47

    main advantage of hash table is that it does almost all ops in ~=O(1). And its very easy to understand and implement. It does solve many "interview problems" efficiently. So if u want to crack a coding interview, make best friends with hash table ;-)

提交回复
热议问题