Complexity of Treemap insertion vs HashMap insertion

前端 未结 4 1273
北海茫月
北海茫月 2021-02-05 10:08

I am confused with the time complexity of these two algorithms.

//time complexity O(nlog(n))
public void usingTreeMap(){
    Map map = ne         


        
4条回答
  •  逝去的感伤
    2021-02-05 10:44

    It might not be. (i.e. when 4 elements out of 10 have same key, then N will be 7), so I believe more duplicate keys, better time for the insertion.

提交回复
热议问题