static void Main(string[] args) { Console.WriteLine("Hi, in this project : "); var qf = new QuickFind(9); Console.WriteLine($"Hello World! {qf.ReturnMessage()}"); qf.Run(); }
/* * for this example: * 0 1__2 3__4 | | | | | 5__6 7 8 9 */ public void Run() { QuickFind quickFind = new QuickFind(9); quickFind.Union(4, 3); quickFind.Union(3, 8); quickFind.Union(9, 4); quickFind.Union(6, 5); quickFind.Union(5, 0); quickFind.Union(7, 2); quickFind.Union(2, 1); Console.WriteLine(quickFind.Find(0, 7)); //is false Console.WriteLine(quickFind.Find(8, 9)); //is true Console.WriteLine(quickFind.Find(6, 2)); //is false Console.WriteLine(quickFind.Find(0, 6)); //is true }