Search for an item by value from TreeMap and TreeSet is O(logN) . The specification for Collections.sort() says that in this case Arrays.sort() and O(N logN) .
Question: why?
I understand correctly that the reason for the implementation of TreeMap in the form of black and mahogany, and sorted collections - in the form of a regular array? If so, why is the difference so big? It turns out that in order to search for an element by value, the enumeration of all elements is done in order and sorting only reduces the possible time for processing each comparison?