TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vishnu Reghu
NA
3
2.1k
Search Algorithm Required
Jun 21 2012 8:42 PM
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
Reply
Answers (
3
)
C# 2010 string
Combine button_Click into textBox_TextChanged event