I am confused with the time complexity of these two algorithms.
//time complexity O(nlog(n))
public void usingTreeMap(){
Map map = ne
Is the time complexity to the usingTreeMap algorithm correct.
The time complexities of the basic TreeMap operations are specified correctly in the Javadoc.
I do know in treemap the insertion time is log(n)
Correct.
but if we iterate over an array of 10 elements does it become nlog(n).
If this means inserting those 10 elements the time complexity is M*log(N) where M is the size of the array and N is the size of the TreeMap. If it doesn't mean that, the question is unclear.