Hi,
I need a c# program ( search algorithm ), ie, When user types a character, the display should update to show all valid choices for the next character
and a list of possible matching stations.
Ex: User Input: D A R T, it should display DARTFORD and DARTMOUTH
Suggested outline is below:
public class Suggestions
{
HastSet<Character> nextLetters { get; set; }
HashSet<String> stations { get; set; }
}
public class StationFinder
{
private static String[] stations = new String[] {"LIVERPOOL LIME STREET", "BIRMINGHAM NEW STREET", "KINGSTON", " DARTFORD", "DARTMOUTH" };
public Suggestions GetSuggestions( String userInput )
{
// TODO Compute result
Suggestions result = new Suggestions();
return result;
}
}
Note: The above code snippet is a suggestion, it can be modified if wish.
Regards,
Vishnu