To find perfect matches, We need to traverse complete list of words....

Part1:

To find perfect matches, We need to traverse complete list of words. And We need to matched particular words with each words present in list. To achieve this, We need two inner loop, One loop will match each characters of matched word with words present in list. When all characters are matched then we will add particular words into list.

Time complexity of algorithm will depend on number of words present in list and length of word. Let suppose if list has n words and length of word is m. then we complexity of algorithm will be: