I am confused with the time complexity of these two algorithms.
//time complexity O(nlog(n)) public void usingTreeMap(){ Map map = ne
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.