Question 9

Suppose you are supplied with a file containing a list of words like ABC, BCD , CAB ( say each word in new line ). now you have to suggest algorithm for this problem –
When a user type some character, we have to suggest him next character and basis of suggestion is that the character you are going to suggest should have maximum occurrence at that position among all these words.
For example , Let’s say words are
Now if user types ‘A’ we have to suggest him ‘B’ as next character because if you see at second position in all words ‘B’ is occurring most number of times ( 2 times ).
similarly if he types ‘AB’ then we need to suggest him third character as ‘C’ as in third index all words have same occurrence but ‘C’ comes first.

New Report