I have an array of strings, each one with a different length. e.g:
s[0] = "sSWXk"
s[1] = "qCk"
s[2] = "sOQQXPbk"
.
.
.
s[x] = "KVfdQk";
I also am given that
n = s[0].length() + s[1].length() + ... + s[x].length()
I need a sorting algorithm with time complexity O(n) for sorting these strings lexicographically, so that (for example)
a < ab < b < bbc < c < ca
Any suggestions? The time complexity is the essential requirement in the algorithm.