Suppose, you are given an array of strings of different lengths, but the total number of characters over all the strings is n. Describe an algorithm using Counting Sort to sort the strings in alphabetic order (eg. algorithm < cs < hello) in O(n) time.
Here is the general idea:
Sort all the strings according to their first character (refer to each string using an index to save time).
Partition the strings according to their first character, and run recursively on each part (deleting in your mind the first character).
I'll let you work out the details.