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
You could build a trie, which should be O(s*n), I believe.
O(s*n)