Home > Articles > Programming > Algorithms

  • Print
  • + Share This
From the author of Q&A

Q&A

  1. Does the Java system sort use one of these methods for String sorts?
  1. No, but the standard implementation includes a fast string compare that makes standard sorts competitive with the methods considered here.
  1. So, I should just use the system sort for String keys?
  1. Probably yes in Java, though if you have huge numbers of strings or need an exceptionally fast sort, you may wish to switch to char arrays instead of String values and use a radix sort.
  1. What is explanation of the log2 N factors on the table in the previous page?
  1. They reflect the idea that most of the comparisons for these algorithms wind up being between keys with a common prefix of length log N. Recent research has established this fact for random strings with careful mathematical analysis (see booksite for reference).
  • + Share This
  • 🔖 Save To Your Account