public void TestCorrectness3() { var facade = new AppFacade(); TrianglePath path = facade.RunMinimumPathFinding(new StringDataProvider("5\r\n4 1\r\n6 3 8\r\n8 4 3 9\r\n6 3 1 2 4\r\n7 7 8 5 3 8")); Assert.AreEqual(path.Sum, 17); }
static void Main(string[] args) { string filePath = string.Empty; if (args.Length == 0) { filePath = "tree.txt"; } else { filePath = args[0]; } Stopwatch watch = Stopwatch.StartNew(); AppFacade facade = new AppFacade(); try { TrianglePath trianglePath = facade.RunMinimumPathFinding(new FileDataProvider(filePath)); Console.WriteLine("Minimal " + trianglePath.ToString()); } catch (Exception e) { Console.WriteLine("There was an error: {0}", e.Message.ToString()); } watch.Stop(); Debug.WriteLine(watch.Elapsed); Console.ReadKey(); }
public void TestCorrectness() { var facade = new AppFacade(); TrianglePath path = facade.RunMinimumPathFinding(new StringDataProvider("7\r\n6 3\r\n3 8 5\r\n11 2 10 9")); Assert.AreEqual(path.Sum, 18); }
/// <summary> /// Runs the minimum path finding. /// </summary> /// <param name="dataProvider">The data provider.</param> /// <returns>TrianglePath.</returns> public TrianglePath RunMinimumPathFinding(IDataProvider dataProvider) { TriangleReader triangleReader = new TriangleReader(dataProvider); Triangle.Triangle triangle = triangleReader.ReadTriangle(); TrianglePath trianglePath = triangle.FindMinimumPath(); return(trianglePath); }
public static void Main(string[] args) { MaxLoot.Test(); return; PerfectSquares.Test(); CountTriplets.Test(); TrianglePath.Test(); FindBusiest.Test(); DeletionDistance.Test(); ShuffleCards.Test(); PowerSet.Test(); //SmallestNonNegativeNumber.Test(); MaxSubsetSum.Test(); Graph.Test(); RankFromStream.Test(); SearchInsert.Test(); RemoveElementTest.TestRemoveElement(); MergeSortedLists.TestMergeTwoLists(); }