We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
That is interesting. However I think the time complexity for this would still be the same as sorting, O(NlogN), since you are performing an insertion into the tree for each element and each insertion takes logN time.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
That is interesting. However I think the time complexity for this would still be the same as sorting, O(NlogN), since you are performing an insertion into the tree for each element and each insertion takes logN time.