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.
It doesn't affect the time complexity in this bigSorting() method itself but it depends on how Unicode / language culture is handled in String.compareTo(). I don't know the internal details of String.compareTo() but what if it has to convert each character in the string and store it into another place? What if it has to repeatedly search in Unicode / culture table?
In my case using C#, it failed with string.Compare() and succeeded with string.CompareOrdinal(). The former works in the same way with Java's String.compareTo(). The latter is to do a character level comparision without considering Unicode / culture.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Big Sorting
You are viewing a single comment's thread. Return to all comments →
@sidajwalia
It doesn't affect the time complexity in this bigSorting() method itself but it depends on how Unicode / language culture is handled in String.compareTo(). I don't know the internal details of String.compareTo() but what if it has to convert each character in the string and store it into another place? What if it has to repeatedly search in Unicode / culture table?
In my case using C#, it failed with string.Compare() and succeeded with string.CompareOrdinal(). The former works in the same way with Java's String.compareTo(). The latter is to do a character level comparision without considering Unicode / culture.