public static void driver() { string s = "stone"; string target = "money"; dw = DictionaryWords.getInstance(s.Length); dict = dw.getDict(); Stopwatch sw = new Stopwatch(); sw.Start(); Stack <string> stk = GenerateLadder(s, target); if (stk.Count <= 0) { Console.WriteLine("No ladder found"); } else { Console.WriteLine("Words in ladder: "); foreach (string str in stk) { Console.WriteLine(str); } } sw.Stop(); Console.WriteLine("Time taken with stacks and queues = {0} ms", sw.ElapsedMilliseconds); }
public GraphLadder(string source) { root = new Node(source); dict = DictionaryWords.getInstance(source.Length).getDict(); }