India’s Best Job Seekers and Training Platform Forums Data Structure Suppose you are supplied with a file containing a list of words like ABC, …

• # Suppose you are supplied with a file containing a list of words like ABC, …

Akash  updated 11 months, 2 weeks ago 1 Member · 1 Post
• ### Akash

at

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
ABC
BCD
CBA
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.