public static void Main() { int numberOfVertices = 9; var graphEdges = new List <Edge> { new Edge(0, 3, 9), new Edge(0, 5, 4), new Edge(0, 8, 5), new Edge(1, 4, 8), new Edge(1, 7, 7), new Edge(2, 6, 12), new Edge(3, 5, 2), new Edge(3, 6, 8), new Edge(3, 8, 20), new Edge(4, 7, 10), new Edge(6, 8, 7) }; var minimumSpanningForest = KruskalAlgorithm.Kruskal(numberOfVertices, graphEdges); Console.WriteLine("Minimum spanning forest weight: " + minimumSpanningForest.Sum(e => e.Weight)); foreach (var edge in minimumSpanningForest) { Console.WriteLine(edge); } }
public void FisrstSampleInput() { int nodesCount = 4; var edges = new List <Edge> { new Edge(0, 1, 9), new Edge(0, 3, 4), new Edge(3, 1, 6), new Edge(3, 2, 11), new Edge(1, 2, 5) }; var expectedEdges = new Edge[] { edges[1], edges[4], edges[2] }; var actualEdges = KruskalAlgorithm.Kruskal(nodesCount, edges); CollectionAssert.AreEqual(expectedEdges, actualEdges); Assert.AreEqual(15, actualEdges.Sum(e => e.Weight)); }
public async Task <IActionResult> GetKruskal() { // var graph = Initializing.CreateGraph(@"../Graph/_Kruskal.txt"); var matrix = new int[8, 8] { { 0, 3, 0, 0, 0, 34, 0, 80 }, { 3, 0, 0, 1, 0, 0, 0, 68 }, { 0, 0, 0, 0, 23, 0, 12, 0 }, { 0, 1, 0, 0, 53, 0, 0, 39 }, { 0, 0, 23, 53, 0, 0, 68, 14 }, { 34, 0, 0, 0, 0, 0, 0, 25 }, { 0, 0, 12, 0, 68, 0, 0, 99 }, { 80, 68, 0, 39, 14, 25, 99, 0 }, }; var graph = Initializing.CreateGraph(matrix); var graphToReturn = KruskalAlgorithm.KruskalSolve(graph); List <Graph> listGraph = new List <Graph> { graph, graphToReturn }; return(Ok(listGraph)); }
public void UnconnectedGraphTest() { var edges = new List <Edge>(); edges.Add(new Edge(1, 2, 10)); var nodes = new HashSet <int> { 1, 2, 3 }; Assert.Throws <UnconnectedGraphException>(() => KruskalAlgorithm.GetMinimumSpanningTree(edges, nodes)); }
public async Task <IActionResult> GetKruskal() { var graph = Initializing.CreateGraph(@"../Graph/_Kruskal.txt"); var graphToReturn = KruskalAlgorithm.KruskalSolve(graph); List <Graph> listGraph = new List <Graph> { graph, graphToReturn }; return(Ok(listGraph)); }
private static void P2Aufgaben() { foreach (var hCurrentGraphFile in GraphFileRessources.P2GraphFiles) { var hNewGraph = AdjacentListGraphImporter.ImportAdjacentList(hCurrentGraphFile, EdgeKind.UndirectedWeighted); var hPrimAlgorithm = new PrimAlgorithm(hNewGraph); var hMstPrim = hPrimAlgorithm.Execute(); var hKruskalAlgorithm = new KruskalAlgorithm(hNewGraph); var hMstKruskal = hKruskalAlgorithm.Execute(); Console.WriteLine(""); } }
private void buttonKruskal_Click(object sender, EventArgs e) { Stopwatch t = new Stopwatch(); t.Start(); var p = KruskalAlgorithm.Kruskal(graph); t.Stop(); Graph dist = new Graph(); foreach (var x in graph.Nodes) { dist.AddNode(x); } double cost = 0; for (int i = 0; i < p.Length / 2; i++) { foreach (var x in graph.Edges) { if (x.From.Id == p[i, 0] && x.To.Id == p[i, 1] || x.From.Id == p[i, 1] && x.To.Id == p[i, 0]) { x.IsMinE = true; cost += x.Weight; dist.AddEdge(x); } } } cost = 0; var distRez = DijkstraAlgorithm.Dijkstra(GraphRepresentation.toWeightMatrix(dist), 0, dist.Nodes.Count); textBoxResult.Text = "Расстояние в метрах от главного коммутатора до: \n\r"; for (int i = 1; i < dist.Nodes.Count; i++) { textBoxResult.Text += "Коммутатора " + i + " = " + distRez[i] + " м." + Environment.NewLine; cost += distRez[i]; } labelCost.Text = "Итоговая стоимость (р) " + cost * Convert.ToDouble(textBoxCost.Text); labelTime.Text = "Время в тиках " + t.ElapsedTicks; Repaint(); }
public void TestKruskalWithSingleEdge() { int numberOfVertices = 2; var graphEdges = new List <Edge> { new Edge(0, 1, 3) }; var minimumSpanningForest = KruskalAlgorithm.Kruskal(numberOfVertices, graphEdges.ToList()); var totalWeight = minimumSpanningForest.Sum(edge => edge.Weight); var expectedTotalWeight = 3; var expectedForest = new[] { graphEdges[0] }; Assert.AreEqual(expectedTotalWeight, totalWeight, "Weights should match."); CollectionAssert.AreEqual( expectedForest, minimumSpanningForest, "The correct edges should be present in the MST in the correct order."); }
public static void KruskalMinimumSpanningTree() { { var expected = MstGraphA.OrderBy(e => e.weight).ToArray(); var actual = KruskalAlgorithm.MinimumSpanningTree(new ArrayGraph(graphA)) .OrderBy(e => e.weight) .ToArray(); Assert.AreEqualSequences(expected, actual, EdgeComparer.UndirectedEdgeComparer); } { var expected = MstGraphB.OrderBy(e => e.weight).ToArray(); var actual = KruskalAlgorithm.MinimumSpanningTree(new ArrayGraph(graphB)) .OrderBy(e => e.weight) .ToArray(); Assert.AreEqualSequences(expected, actual, EdgeComparer.UndirectedEdgeComparer); } }
public void ThirdSampleInput() { int nodesCount = 8; var edges = new List <Edge> { new Edge(0, 1, 4), new Edge(0, 2, 5), new Edge(0, 3, 1), new Edge(1, 2, 8), new Edge(1, 3, 2), new Edge(2, 3, 3), new Edge(2, 4, 16), new Edge(2, 5, 9), new Edge(3, 4, 7), new Edge(3, 5, 14), new Edge(4, 5, 12), new Edge(4, 6, 22), new Edge(4, 7, 9), new Edge(5, 6, 6), new Edge(5, 7, 18), new Edge(6, 7, 15) }; var expectedEdges = new Edge[] { edges[2], edges[4], edges[5], edges[13], edges[8], edges[7], edges[12] }; var actualEdges = KruskalAlgorithm.Kruskal(nodesCount, edges); CollectionAssert.AreEqual(expectedEdges, actualEdges); Assert.AreEqual(37, actualEdges.Sum(e => e.Weight)); }
public void SecondSampleInput() { int nodesCount = 9; var edges = new List <Edge> { new Edge(1, 4, 8), new Edge(4, 0, 6), new Edge(1, 7, 7), new Edge(4, 7, 10), new Edge(4, 8, 3), new Edge(7, 8, 4), new Edge(0, 8, 5), new Edge(8, 6, 9), new Edge(8, 3, 20), new Edge(0, 5, 4), new Edge(0, 3, 9), new Edge(6, 3, 8), new Edge(6, 2, 12), new Edge(5, 3, 2), new Edge(3, 2, 14) }; var expectedEdges = new Edge[] { edges[13], edges[4], edges[5], edges[9], edges[6], edges[2], edges[11], edges[12] }; var actualEdges = KruskalAlgorithm.Kruskal(nodesCount, edges); CollectionAssert.AreEqual(expectedEdges, actualEdges); Assert.AreEqual(45, actualEdges.Sum(e => e.Weight)); }
public void TestKruskalWith9VerticesAnd11Edges() { int numberOfVertices = 9; var graphEdges = new List <Edge> { new Edge(0, 3, 9), new Edge(0, 5, 4), new Edge(0, 8, 5), new Edge(1, 4, 8), new Edge(1, 7, 7), new Edge(2, 6, 12), new Edge(3, 5, 2), new Edge(3, 6, 8), new Edge(3, 8, 20), new Edge(4, 7, 10), new Edge(6, 8, 7) }; var minimumSpanningForest = KruskalAlgorithm.Kruskal(numberOfVertices, graphEdges.ToList()); var totalWeight = minimumSpanningForest.Sum(edge => edge.Weight); var expectedTotalWeight = 45; var expectedForest = new[] { graphEdges[6], graphEdges[1], graphEdges[2], graphEdges[4], graphEdges[10], graphEdges[3], graphEdges[5] }; Assert.AreEqual(expectedTotalWeight, totalWeight, "Weights should match."); CollectionAssert.AreEqual( expectedForest, minimumSpanningForest, "The correct edges should be present in the MST in the correct order."); }
public void GraphTest() { var edges = new List <Edge>(); edges.Add(new Edge(1, 2, -10)); edges.Add(new Edge(2, 3, -20)); edges.Add(new Edge(3, 5, -30)); edges.Add(new Edge(5, 4, -40)); edges.Add(new Edge(1, 4, -1)); edges.Add(new Edge(1, 5, -3)); edges.Add(new Edge(3, 4, -2)); var answerList = new List <Edge>(); answerList.Add(new Edge(5, 4, -40)); answerList.Add(new Edge(3, 5, -30)); answerList.Add(new Edge(2, 3, -20)); answerList.Add(new Edge(1, 2, -10)); var nodes = new HashSet <int> { 1, 2, 3, 4, 5 }; Assert.IsTrue(answerList.SequenceEqual(KruskalAlgorithm.GetMinimumSpanningTree(edges, nodes), new ListComparer())); }
private void Form1_Load(object sender, EventArgs e) { //Flody Stopwatch sh = new Stopwatch(); sh.Start(); Flody fl = new Flody(); fl.Main(); TimeSpan tsFlody = sh.Elapsed; listBox1.Items.Add("Flody : " + tsFlody.TotalMilliseconds + "ms"); sh.Reset(); sh.Start(); chart1.Series["Süre"].Points.AddXY("Flody", tsFlody.TotalMilliseconds); //Dijkstra Stopwatch st = new Stopwatch(); st.Start(); Dijkstra dj = new Dijkstra(); dj.Main(); TimeSpan tsDijkstra = st.Elapsed; listBox1.Items.Add("Dijkstra : " + tsDijkstra.TotalMilliseconds + "ms"); st.Reset(); st.Start(); chart1.Series["Süre"].Points.AddXY("Dijkstra", tsDijkstra.TotalMilliseconds); //Kruskal Stopwatch spw = new Stopwatch(); spw.Start(); KruskalAlgorithm kr = new KruskalAlgorithm(); kr.Main(); TimeSpan tsKruskalAlgorithm = spw.Elapsed; listBox1.Items.Add("Kruskal : " + tsKruskalAlgorithm.TotalMilliseconds + "ms"); spw.Reset(); spw.Start(); chart1.Series["Süre"].Points.AddXY("Kruskal", tsKruskalAlgorithm.TotalMilliseconds); //FloydWarshall Stopwatch wh = new Stopwatch(); wh.Start(); FloydWarshallAlgo fw = new FloydWarshallAlgo(); fw.Main(); TimeSpan tsFloydWarshallAlgo = wh.Elapsed; listBox1.Items.Add("FloydWarshall: " + tsFloydWarshallAlgo.TotalMilliseconds + "ms"); wh.Reset(); wh.Start(); chart1.Series["Süre"].Points.AddXY("FloydWarshall", tsFloydWarshallAlgo.TotalMilliseconds); //BFS Stopwatch wt = new Stopwatch(); wt.Start(); BFS bs = new BFS(); bs.Main(); TimeSpan tsBFS = wh.Elapsed; listBox1.Items.Add("BreadthFirst : " + tsBFS.TotalMilliseconds + "ms"); wt.Reset(); wt.Start(); chart1.Series["Süre"].Points.AddXY("BFS", tsBFS.TotalMilliseconds); //DFS Stopwatch sp = new Stopwatch(); sp.Start(); DFS ds = new DFS(); ds.Main(); TimeSpan tsDFS = wh.Elapsed; listBox1.Items.Add("DepthFirst : " + tsDFS.TotalMilliseconds + "ms"); sp.Reset(); sp.Start(); chart1.Series["Süre"].Points.AddXY("DFS", tsDFS.TotalMilliseconds); chart1.Series["Süre"].Color = Color.Purple; //PriorityQueue Stopwatch so = new Stopwatch(); so.Start(); PriorityQueue pq = new PriorityQueue(); pq.heapSort(); TimeSpan tsPriorityQueue = so.Elapsed; listBox1.Items.Add("PriorityQueue: " + tsPriorityQueue.TotalMilliseconds + "ms"); so.Reset(); so.Start(); chart1.Series["Süre"].Points.AddXY("PriorityQueue", tsPriorityQueue.TotalMilliseconds); //BellmanFord Stopwatch sw = new Stopwatch(); sw.Start(); BellmanFord bf = new BellmanFord(); bf.Main(); TimeSpan tsBellmanFord = sw.Elapsed; listBox1.Items.Add("Bellman Ford: " + tsBellmanFord.TotalMilliseconds + " ms"); sw.Reset(); sw.Start(); chart1.Series["Süre"].Points.AddXY("Bellman Ford", tsBellmanFord.TotalMilliseconds); chart1.Series["Süre"].Color = Color.DarkMagenta; }
static void Main(string[] args) { // StringProblems //Test calls for Reverse string string input = "jacob"; Console.WriteLine(input + "<=>" + new string(SimpleProblem.ReverseString(input.ToCharArray()))); input = "jake"; Console.WriteLine(input + "<=>" + new string(SimpleProblem.ReverseString(input.ToCharArray()))); input = ""; Console.WriteLine(input + "<=>" + new string(SimpleProblem.ReverseString(input.ToCharArray()))); input = "jdshjdh@#$%^&)"; Console.WriteLine(input + "<=>" + new string(SimpleProblem.ReverseString(input.ToCharArray()))); ReplaceSpaces.TestReplaceSpacesInplace(); Anagrams.TestIsAnagramAlgo(); StringRotation.TestIsThisRotatedString(); RemoveDuplicates.TestRemoveDuplicatesFromString(); StringToLongConverter.TestStringToLong(); RegexMatching.TestMatch(); SumOfTwoNumbersInArray.TestSumOfTwoNumbersInArray(); SumOfThreeNumbersInArray.TestSumOfThreeNumbersInArray(); PairInSortedArrayClosestToAParticularValue.TestPairInSortedArrayClosestToAParticularValue(); PalindromeInStringPermutation.TestPalindromeInStringPermutation(); EditDistanceBetweenStrings.TestEditDistanceBetweenStrings(); AnagramIsPalindrome.TestAnagramIsPalindrome(); GreatestPalindrome.TestGreatestPalindrome(); ReverseStringWithoutVowels.TestReverseStringWithoutVowels(); LongestSubstringWithKDistinctChars.TestLongestSubstringWithKDistinctChars(); // Pattern Matching NativePatternMatching.TestNativePatternMatching(); KMPPatternMatching.TestKMPPatternMatching(); BoyerMoorePatternMatching.TestPatternMatching(); RabinKarp.TestRabinKarp(); //Console.ReadLine(); //Array Problems ArrayOfNumsIncrement.TestIncrementArrayOfNumbers(); MajorityElement.TestFindMajorityElement(); Merge2SortedArrays.TestMergeSortedArrays(); MaxDistanceInArray.TestMaxDistanceInArray(); MovingAverage.TestMovingAverage(); TotalAverage.TestTotalAverage(); ArrayWithGreaterElementToRight.TestArrayWithGreaterElementToRight(); WaterCollectedInPuddleShownByHistogram.TestWaterCollectedInPuddleShownByHistogram(); CountOfPairsWhichSumUpToGivenSum.TestCountOfPairsWhichSumUpToGivenSum(); //Median.TestGetMedianOf2SortedArray(); // Sorting Problems SelectionSort.TestSorting(); BubbleSort.TestSorting(); InsertionSort.TestSorting(); ShellSort.TestSorting(); MergeSort.TestMergeSort(); QuickSort.TestQuickSort(); HeapSortTester.TestHeapSort(); CountingSort.TestSorting(); RadixSort.TestRadixSort(); DutchNationalFlag.TestDutchNationalFlag(); SortedSquares.TestSortedSquares(); // Matrix Problem Rotate_Matrix_90_degree.TestRotateMatrix(); Matrix_Column_Rows_0.TestMakeRowColZero1(); Matrix_Column_Rows_0.TestMakeRowColZero2(); RotateMatrix180.TestRotateMatrix180(); SumOfMatrixElementsFormedByRectangleWithCoordinates.TestSumOfMatrixElements(); SortedArrayFromSortedMatrix.TestSortedArrayFromSortedMatrix(); SearchWordInMatrix.TestSearchWordInMatrix(); MaxOnesInRow.TestMaxOnesInRow(); MatrixAsTriangle.TestMatrixAsTriangle(); MinRangeInMatrix.TestMinRangeInMatrix(); PrintMatrixAsSnake.TestPrintMatrixAsSnake(); PrintMatrixInSpiral.TestPrintMatrixInSpiral(); MaxSqAreaInBinaryMatrix.TestMaxRectAreaInBinaryMatrix(); TicTacToeWinner.TestTicTacToeWinner(); WaterfallCreation.TestWaterfallCreation(); // Linked list Problems DeleteLinkedListNode.TestDeleteFirstNode(); DeleteDuplicatesFromLinkedList.TestDeleteDuplicates(); NthLastElementOfLinkedList.TestNthLastNodeOfLinkedList(); DeleteNodeWithDirectReference.TestDeleteNode(); AddNumbers.TestAddNumbersRepresentedByLinkedList(); CopyLinkedListWithRandomNode.TestGetCopiedLinkedListWithRandomNode(); CommonElementInTwoLinkedList.TestCommonElement(); ReverseAdjacentNodesInLinkedList.TestReverseAdjacentNodes(); MergeSortedLinkedList.TestMerge(); CycleInLinkedList.TestStartOfCycleInLinkedList(); MedianForCircularLinkedList.TestGetMedian(); ReverseLinkedList.TestReverseLinkedList(); SortedCircularLinkedList.TestCircularLinkedList(); // stack and queue problem ThreeStackWithOneArray.TestThreeStackWithOneArray(); StackWithMinElement.TestStackWithMinElement(); StackOfPlates.TestStackOfPlates(); SortAStack.TestSortAStackAscending(); WellFormedExpression.TestWellFormedExpression(); QueueVia2Stack.TestQueueVia2Stack(); LRUCache.TestLRUCache(); EvaluatePrefixNotation.TestGetPrefixNotationResult(); EvaluateInflixNotation.TestGetInflixNotationResults(); EvaluatePostfixNotation.TestGetPostfixNotationResult(); TestCircularQueue.TestCircularQueueWithDifferentCases(); LargestAreaInHistogram.TestLargestAreaInHistogram(); TextEditerWithUndo.TestTextEditerWithUndo(); //Recursion Problem TowerOfHanoi.TestTowerOfHanoi(); MaxSumOfConsecutiveNums.TestMaxSumOfConsecutiveNums(); // Back tracking problems Sudoku.TestSudokuSolver(); HamiltonianCycle.TestHamiltonianCycle(); GraphColoringWithMColors.TestGraphColoringWithMColors(); MakeLargestIsland.TestMakeLargestIsland(); //Misc Problem MinNumOfCoins.TestMinNumOfCoins(); IsPrime.TestCheckPrime(); SquareRoot.TestCalculateSquareRoot(); CreditCardCheck.TestLuhnAlgo(); ExcelFirstRowConversion.TestCovertExcelColumnToLong(); Skyline.TestSkyline(); SumOfSquaresWithoutMultiplication.TestSumOfSquares(); MergeIntervals.TestMergeIntervals(); WidthOfCalendar.TestWidthOfCalendar(); JosephusProblem.TestJosephusProblem(); // Permutation and Combination problem ShuffleAList.TestFisherYatesAlgo(); CombinationsOfBinaryString.TestCombinationsOfBinaryString(); AllCombinationsOfString.TestAllCombinationsOfString(); AllPermutationsOfString.TestAllPermutationsOfString(); PhoneNumberToWords.TestPhoneNumberToWords(); AllNumbersInRangeWithDifferentDigits.TestAllNumbersInRangeWithDifferentDigits(); DivideSetIntoTwoEqualSetsWithMinSumDiff.TestDivideSetIntoTwoEqualSetsWithMinSumDiff(); PowerSet.TestPowerSet(); AllCombinationsOfParenthesis.TestAllCombinationsOfParenthesis(); GoodDiceRoll.TestGoodDiceRoll(); PermutationsOfValidTime.TestPermutationsOfValidTime(); // Tree Problems TreeFromExpression.TestCreateTreeFromExpression(); TestBinarySearchTree.TestDifferentOperationsOnBST(); AncestorOfTwoNodesInBST.TestAncestorOfTwoNodesInBST(); CheckBTisBST.TestCheckBTisBST(); MaxSumOnTreeBranch.TestMaxSum(); WalkTheTree.TestWalkTheTree(); SkewedBSTToCompleteBST.TestConvertSkewedBSTToCompleteBST(); CheckIfTheTreeIsBalanced.TestIsTreeBalanced(); LinkedListOfTreeNodesAtEachDepth.TestCreateLinkedListOfTreeNodesAtEachDepth(); PrintBinaryTreeNodeAtEachLevel.TestPrintBinaryTreeNodeAtEachLevel(); PrintBinaryTreeNodeAtEachLevelSpirally.TestPrintBinaryTreeNodeAtEachLevelSpirally(); TreeSubtreeOfAnother.TestMatchTree(); AncestorOfTwoNodesInBT.TestGetAncestorOfTwoNodesInBT(); AncestorOfMultiNodesInBT.TestAncestorOfMultiNodesInBT(); LinkedListFromLeavesOfBT.TestLinkedListFromLeavesOfBT(); ExteriorOfBT.TestPrintExteriorOfBT(); DepthOfTree.TestGetDepthOfTree(); TreeToColumns.TestTreeToColumns(); KthSmallestElementFromBST.TestKthSmallestElementFromBST(); MakeBSTFromPreOrder.TestMakeBSTFromPreOrder(); MirrorATree.TestMirrorATree(); CloneABTWithRandPointer.TestCloneABTWithRandPointer(); TreeWithInorderAndPreorder.TestTreeWithInorderAndPreorder(); TreeWithInorderAndPostorder.TestTreeWithInorderAndPostorder(); TreePathSumsToValue.TestTreePathSumsToValue(); AllPathInNArayTree.TestAllPathInNArayTree(); SerializeDeserializeBinaryTree.TestSerializeDeserializeBinaryTree(); SerializeDeserializeAnNaryTree.TestSerializeDeserializeAnNaryTree(); AncestorOfTwoNodesInNaryTree.TestAncestorOfTwoNodesInNaryTree(); AbsOfMaxAndSecondMaxDepthInBT.TestGetAbsOfMaxAndSecondMaxDepthInBT(); // Trie problems CreateAndSearchSimpleTrie.TestCreateAndSearchSimpleTrie(); // ToDo: have a problem of suffix trees ShortestPrefix.TestGetShortestPrefixNotPresentInStringSet(); // Dynamic Programming problems LongestCommonSubsequence.TestGetLongestCommonSubsequence(); LongestPalindromeSubString.TestGetLongestPalindromeSubString(); LongestPalindromicSubsequence.TestGetLongestPalindromicSubsequence(); MaximumAs.TestGetMaximumAs(); MinNumberOfJumps.TestGetMinimumNumberOfJumps(); LongestCommonSubString.TestGetLongestCommonSubString(); KnapSackProblem.TestGetTheMaximumValueWithLimitedWeight(); TreeCuttingProblem.TestGetTreeCuttingToMaximizeProfits(); WordBreaking.TestBreakTheWords(); DistanceOfWords.TestDistanceOfWords(); LongestIncreasingSubSequence.TestLongestIncreasingSubSequence(); MinCostPath.TestMinCostPath(); DifferentWaysForCoinChange.TestDifferentWaysForCoinChange(); MatrixMultiplication.TestMatrixMultiplication(); BinomialCoefficient.TestBinomialCoefficient(); BoxStacking.TestBoxStacking(); WordWrapping.TestWordWrapping(); MaxSubMatrixWithAllOnes.TestMaxSubMatrixWithAllOnes(); LongestSubStringWithEqualSum.TestLongestSubStringWithEqualSum(); PartitionArrayIntoEqualSumSets.TestPartitionArrayIntoEqualSumSets(); MaxSumRectangle.TestMaxSumRectangle(); RegularExpressionMatch.TestRegularExpressionMatch(); NumRepresentedByPerfectSquares.TestNumRepresentedByPerfectSquares(); LongestCommonSubsequenceInSameString.TestLongestCommonSubsequenceInSameString(); StringDecodeAsAlphabets.TestStringDecodeAsAlphabets(); BalloonBursting.TestBalloonBursting(); TravellingSalesmanProblem.TestTravellingSalesmanProblem(); MaxSumWithoutAdjacentElements.TestMaxSumWithoutAdjacentElements(); MaxPathThroughMatrix.TestMaxPathThroughMatrix(); BrickLaying.TestBrickLaying(); JobSchedullingWithConstraints.TestJobSchedullingWithConstraints(); EggDropMinTrials.TestEggDropMinTrials(); // Graph Problems ShortestPath.TestGetShortestPathBetween2Vertex(); CycleInDirectedGraph.TestIsCycleInDirectedGraph(); CycleInUnDirectedGraph.TestIsCycleInUnDirectedGraph(); SolveAMaze.TestSolveAMaze(); AllPathsGivenStartEndVertex.TestGetAllPathsInGraphFromStartVertexToEndVertex(); AllPaths.TestGetAllPathsInGraphFromStartVertex(); ColorVertices.TestColorVerticesWithDifferentColor(); CheckBipartiteGraph.TestCheckBipartiteGraph(); TransformOneWordToAnother.TestGetTransformation(); ConstraintsVerification.TestConstraintsVerification(); ExtendedContactsInSocialNetwork.TestComputeExtendedContacts(); CourseScheduling.TestCourseScheduling(); SnakeAndLadder.TestSnakeAndLadder(); IsGraphATree.TestIsGraphATree(); ReverseGraph.TestReverseGraph(); StronglyConnectedGraph.TestStronglyConnectedGraph(); ConnectedComponents.TestConnectedComponents(); ContinentalDivide.TestContinentalDivide(); CloneGraph.TestCloneGraph(); Wordament.TestWordament(); // ShortestPathAlgo FloydWarshall.TestFloydWarshall(); DijkstraAlgorithm.TestDijkstraAlgorithm(); BellmanFord.TestBellmanFord(); TravelFromLeftToRightInMatrix.TestTravelFromLeftToRightInMatrix(); HeuristicSearch.TestHeuristicSearch(); AStar.TestAStar(); ShortestPathWhenObstaclesRemoved.TestShortestPathWhenObstaclesRemoved(); ShortestDistanceFromRoomsToGates.TestShortestDistanceFromRoomsToGates(); //MaxFlow FordFulkersonEdmondKarp.TestFordFulkersonEdmondKarp(); MinCut.TestMinCut(); MaximumBipartiteMatching.TestMaximumBipartiteMatching(); //Minimum Spanning Tree KruskalAlgorithm.TestKruskalAlgorithm(); PrimsAlgorithm.TestPrimsAlgorithm(); //Heap problems BasicMaxHeap.TestMaxHeap(); BasicMinHeap.TestMinHeap(); TestMinHeapMap.DoTest(); TestPriorityQueue.Run(); MedianForAStreamOfNumbers.TestMedianForAStreamOfNumbers(); //DisjointSets TestingDisjointSet.Run(); //TestWeightedDisjointSetsWithPathCompression.Run(); // this runs slow, hence commenting it //Geometry ClosestPairOfPoints.TestClosestPairOfPoints(); RectangleIntersection.TestRectangleIntersection(); LineSegmentIntersection.TestLineSegmentIntersection(); ConvexHull.TestConvexHull(); KClosestPointToOrigin.TestKClosestPointToOrigin(); //Greedy Algorithm HuffmanCoding.TestHuffmanCoding(); //Randomized Algorithm RandomGeneration.TestRandomGeneration(); // Bit Algorithms IntHaveOppositeSigns.TestIntHaveOppositeSigns(); Parity.TestParity(); //Math Problem ZerosInFactorial.TestZerosInFactorial(); GetAllPrimeFactors.TestGetAllPrimeFactors(); NumberOfFactors.TestNumberOfFactors(); AllFactors.TestAllFactors(); MultiplyLongNumbers.TestMultiplyLongNumbers(); NextLargestPermutation.TestNextLargestPermutation(); AllPrimesTillN.TestAllPrimesTillN(); PascalsTriangle.TestPascalsTriangle(); SubtractLongNumbers.TestSubtractLongNumbers(); //Search problems SearchInSortedRotatedArray.TestSearchInSortedRotatedArray(); KClosestElementInArray.TestKClosestElementInArray(); SearchInSortedMatrix.TestSearchInSortedMatrix(); BinarySearchUnbounded.TestBinarySearchUnbounded(); LinkedListSublistSearch.TestLinkedListSublistSearch(); NoOfOccuranceInSortedArray.TestNoOfOccuranceInSortedArray(); GetSmallestInSortedRotatedArray.TestGetSmallestInSortedRotatedArray(); //Distributed algorithms KWayMerge.TestKWayMerge(); Console.ReadLine(); }