This is probably a very stupid question. I made a working program that reads in a word list and spits out all the anagram classes in the word list in alphabetical order. For example, if the program read in the list:
the program will output:
pots stop tops
If you're familiar with coding anagram programs, I used two sorts:
- Quicksort to sort out the individual words. The original and the sorted words are stored in each node of the link list.
- Mergesort to sort out the linked list.
My questions are, what would be the Big-O running time of my program if the input word list have N words and L is the maximum length of any word? (would it be NlogN+LlogL since the two sorts have a Big-O of nlogn?)
Also, what would be the Big-O if the input list contains only two words?