public override void Compute() { switch (base.GetImplementationID()) { case 1: base.StoreResult(LCSGeneral()); break; } CUI.ShowTimeElapsed(stopWatch.Elapsed); }
/// <summary> /// Solve the problem and store the result using the implementations chosen by user /// </summary> public override void Compute() { if (lengthOfCut > costs.Length) { throw new DynamicProgrammingException("\nLength of Cut can not be more than the cost array provided, if you want to cut the rod into a length x then u must provide separate cost of each length cut i.e. cost array must be greater than x."); } switch (methodNumber) { case 1: base.StoreResult(SimpleRecursive()); break; case 2: base.StoreResult(TopDownMemoization()); break; case 3: base.StoreResult(BottomUpMemoization()); break; case 4: StoreResult(BottomUpSolution()); break; } CUI.ShowTimeElapsed(stopWatch.Elapsed); }