Efficient string sorting algorithm

后端 未结 3 1694
伪装坚强ぢ
伪装坚强ぢ 2021-02-13 18:44

Sorting strings by comparisons (e.g. standard QuickSort + strcmp-like function) may be a bit slow, especially for long strings sharing a common prefix (the comparison function t

3条回答
  •  一个人的身影
    2021-02-13 19:51

    If you know that the string consist only of certain characters (which is almost always the case), you can use a variant of BucketSort or RadixSort.

提交回复
热议问题