├── .gitignore
├── Chapter 01 - Introduction To Algorithms
├── DevNumber1.Tests
│ ├── DevNumber1.Tests.csproj
│ ├── DevNumber1Tests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── IntroductionToAlgorithms.Tests.sln
├── IntroductionToAlgorithms.sln
├── IntroductionToAlgorithms
│ ├── BaseConversions
│ │ ├── BaseConversions.cs
│ │ ├── BaseConversions.csproj
│ │ └── packages.config
│ ├── BellNumbers
│ │ ├── BellNumbers.cs
│ │ ├── BellNumbers.csproj
│ │ └── packages.config
│ ├── BinomialCoefficientCalculator
│ │ ├── BinomialCoefficientCalculator.cs
│ │ ├── BinomialCoefficientCalculator.csproj
│ │ └── packages.config
│ ├── CombinationsGenerator
│ │ ├── CombinationsGenerator.cs
│ │ ├── CombinationsGenerator.csproj
│ │ └── packages.config
│ ├── DevNumber1
│ │ ├── DevNumber1.cs
│ │ ├── DevNumber1.csproj
│ │ └── packages.config
│ ├── DevNumber2
│ │ ├── DevNumber2.cs
│ │ ├── DevNumber2.csproj
│ │ └── packages.config
│ ├── DevNumber3
│ │ ├── DevNumber3.cs
│ │ ├── DevNumber3.csproj
│ │ └── packages.config
│ ├── DigitsCountOfANumber
│ │ ├── DigitsCountOfANumber.cs
│ │ ├── DigitsCountOfANumber.csproj
│ │ └── packages.config
│ ├── DigitsOfNFactorial
│ │ ├── DigitsOfNFactorial.cs
│ │ ├── DigitsOfNFactorial.csproj
│ │ └── packages.config
│ ├── FactorialCalculator
│ │ ├── FactorialCalculator.cs
│ │ ├── FactorialCalculator.csproj
│ │ └── packages.config
│ ├── FactorialZeroesCountAtTheEnd
│ │ ├── FactorialTrailingZeroesFinder.cs
│ │ ├── FactorialZeroesCountAtTheEnd.csproj
│ │ └── packages.config
│ ├── FastRecursiveFactorialCalculator
│ │ ├── FastRecursiveFactorialCalculator.cs
│ │ ├── FastRecursiveFactorialCalculator.csproj
│ │ └── packages.config
│ ├── FillingAndPrintingMatrix
│ │ ├── FillingAndPrintingMatrix.cs
│ │ ├── FillingAndPrintingMatrix.csproj
│ │ └── packages.config
│ ├── GetPowerOfANumber
│ │ ├── GetPowerOfANumber.cs
│ │ ├── GetPowerOfANumber.csproj
│ │ └── packages.config
│ ├── IterativeFibonacci
│ │ ├── IterativeFibonacci.cs
│ │ ├── IterativeFibonacci.csproj
│ │ └── packages.config
│ ├── IterativeGreatestCommonDivisor
│ │ ├── IterativeGreatestCommonDivisor.cs
│ │ ├── IterativeGreatestCommonDivisor.csproj
│ │ └── packages.config
│ ├── IterativePrint
│ │ ├── IterativePrint.cs
│ │ ├── IterativePrint.csproj
│ │ └── packages.config
│ ├── LeastCommonMultiple
│ │ ├── LeastCommonMultiple.cs
│ │ ├── LeastCommonMultiple.csproj
│ │ └── packages.config
│ ├── ListPreprocessedPrimeNumbersFinder
│ │ ├── ListPreprocessedPrimeNumbersFinder.cs
│ │ ├── ListPreprocessedPrimeNumbersFinder.csproj
│ │ └── packages.config
│ ├── MatrixMultiplication
│ │ ├── MatrixMultiplication.cs
│ │ ├── MatrixMultiplication.csproj
│ │ └── packages.config
│ ├── MersennePrimeNumbersFinder
│ │ ├── MersennePrimeNumbersFinder.cs
│ │ ├── MersennePrimeNumbersFinder.csproj
│ │ └── packages.config
│ ├── PascalTriangle
│ │ ├── PascalTriangle.cs
│ │ ├── PascalTriangle.csproj
│ │ └── packages.config
│ ├── PermutationsCoding
│ │ ├── PermutationsCoding.cs
│ │ ├── PermutationsCoding.csproj
│ │ └── packages.config
│ ├── PermutationsGenerator
│ │ ├── PermutationsGenerator.cs
│ │ ├── PermutationsGenerator.csproj
│ │ └── packages.config
│ ├── PermutationsGeneratorWithSwapping
│ │ ├── PermutationsGeneratorWithSwapping.cs
│ │ ├── PermutationsGeneratorWithSwapping.csproj
│ │ └── packages.config
│ ├── PreprocessedPrimeNumbersFinder
│ │ ├── PreprocessedPrimeNumbersFinder.cs
│ │ ├── PreprocessedPrimeNumbersFinder.csproj
│ │ └── packages.config
│ ├── PrimeFactorization
│ │ ├── PrimeFactorization.cs
│ │ ├── PrimeFactorization.csproj
│ │ └── packages.config
│ ├── PrimeNimbersEratosthenes
│ │ ├── App.config
│ │ ├── PrimeNimbersEratosthenes.csproj
│ │ ├── PrimeNimbersEratosthenesSieve.cs
│ │ └── packages.config
│ ├── PrimeNumbersFinder
│ │ ├── PrimeNumbersFinder.cs
│ │ ├── PrimeNumbersFinder.csproj
│ │ └── packages.config
│ ├── ProductOfArrayElements
│ │ ├── ProductOfArrayElements.cs
│ │ ├── ProductOfArrayElements.csproj
│ │ └── packages.config
│ ├── RecursiveFactorialCalculator
│ │ ├── RecursiveFactorialCalculator.cs
│ │ ├── RecursiveFactorialCalculator.csproj
│ │ └── packages.config
│ ├── RecursiveFibonacci
│ │ ├── RecursiveFibonacci.cs
│ │ ├── RecursiveFibonacci.csproj
│ │ └── packages.config
│ ├── RecursiveGreatestCommonDivisor
│ │ ├── RecursiveGreatestCommonDivisor.cs
│ │ ├── RecursiveGreatestCommonDivisor.csproj
│ │ └── packages.config
│ ├── RecursivePrint
│ │ ├── RecursivePrint.cs
│ │ ├── RecursivePrint.csproj
│ │ └── packages.config
│ ├── RomanNumerals
│ │ ├── RomanNumerals.cs
│ │ ├── RomanNumerals.csproj
│ │ └── packages.config
│ ├── SequencePrint1
│ │ ├── SequencePrint1.cs
│ │ ├── SequencePrint1.csproj
│ │ └── packages.config
│ ├── SequencePrint2
│ │ ├── SequencePrint2.cs
│ │ ├── SequencePrint2.csproj
│ │ └── packages.config
│ ├── SequencePrint3
│ │ ├── SequencePrint3.cs
│ │ ├── SequencePrint3.csproj
│ │ └── packages.config
│ ├── SumOfArrayElements
│ │ ├── SumOfArrayElements.cs
│ │ ├── SumOfArrayElements.csproj
│ │ └── packages.config
│ ├── SumOfFirstNNaturalNumbers
│ │ ├── SumOfFirstNNaturalNumbers.cs
│ │ ├── SumOfFirstNNaturalNumbers.csproj
│ │ └── packages.config
│ ├── SumOfMatrices
│ │ ├── SumOfMatrices.cs
│ │ ├── SumOfMatrices.csproj
│ │ └── packages.config
│ ├── SumZero
│ │ ├── SumZero.cs
│ │ ├── SumZero.csproj
│ │ └── packages.config
│ └── VariationsGenerator
│ │ ├── VariationsGenerator.cs
│ │ ├── VariationsGenerator.csproj
│ │ └── packages.config
└── Settings.StyleCop
├── Chapter 02 - Introduction To Data Structures
├── Pure CSharp Implementations
│ ├── BinaryTree
│ │ ├── BinaryTree.cs
│ │ ├── BinaryTree.csproj
│ │ ├── BinaryTreeExample.cs
│ │ ├── TreeNode.cs
│ │ └── packages.config
│ ├── HashTable
│ │ ├── HashTable.cs
│ │ ├── HashTable.csproj
│ │ ├── HashTableExample.cs
│ │ └── packages.config
│ ├── IntroductionToDataStructuresPureCSharp.sln
│ ├── LinkedList
│ │ ├── LinkeListExample.cs
│ │ ├── LinkedList.cs
│ │ ├── LinkedList.csproj
│ │ ├── LinkedListNode.cs
│ │ └── packages.config
│ ├── Queue
│ │ ├── Queue.cs
│ │ ├── Queue.csproj
│ │ ├── QueueExample.cs
│ │ └── packages.config
│ ├── Settings.StyleCop
│ └── Stack
│ │ ├── Stack.cs
│ │ ├── Stack.csproj
│ │ ├── StackExample.cs
│ │ └── packages.config
└── Strictly following book implementations
│ ├── BinaryTree
│ ├── BinaryTree.cs
│ ├── BinaryTree.csproj
│ ├── Program.cs
│ └── packages.config
│ ├── HashSet
│ ├── HashSet.cs
│ ├── HashSet.csproj
│ ├── SingleWord.cs
│ └── packages.config
│ ├── HashTable
│ ├── HashTable.cs
│ ├── HashTable.csproj
│ ├── LinkedList.cs
│ └── packages.config
│ ├── IntroductionToDataStructures.sln
│ ├── LinkedList
│ ├── LinkedList.cs
│ ├── LinkedList.csproj
│ ├── Program.cs
│ └── packages.config
│ ├── Queue
│ ├── Program.cs
│ ├── Queue.cs
│ ├── Queue.csproj
│ └── packages.config
│ ├── Settings.StyleCop
│ ├── Stack1
│ ├── Program.cs
│ ├── Stack.cs
│ ├── Stack1.csproj
│ └── packages.config
│ └── Stack2
│ ├── Program.cs
│ ├── Stack.cs
│ ├── Stack2.csproj
│ └── packages.config
├── Chapter 03 - Sorting Algorithms
├── BitwiseSort.Tests
│ ├── BitwiseSort.Tests.csproj
│ ├── BitwiseSortTests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── BitwiseSort2.Tests
│ ├── BitwiseSort2.Tests.csproj
│ ├── BitwiseSortTests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── BubbleSort.Tests
│ ├── BubbleSort.Tests.csproj
│ ├── BubbleSortTests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── BubbleSort2.Tests
│ ├── BubbleSort2.Tests.csproj
│ ├── BubbleSortTests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── CombSorter.Tests
│ ├── CombSorter.Tests.csproj
│ ├── CombSorterTests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── CountSorter.Tests
│ ├── CountSorter.Tests.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── UnitTest1.cs
│ └── packages.config
├── CountSorter2.Tests
│ ├── CountSorter2.Tests.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── UnitTest1.cs
│ └── packages.config
├── HeapSort.Tests
│ ├── HeapSort.Tests.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── UnitTest1.cs
│ └── packages.config
├── InsertionSort.Tests
│ ├── InsertionSort.Tests.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── UnitTest1.cs
│ └── packages.config
├── InsertionSort2.Tests
│ ├── InsertionSort2.Tests.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── UnitTest1.cs
│ └── packages.config
├── InsertionSort3.Tests
│ ├── InsertionSort3.Tests.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── UnitTest1.cs
│ └── packages.config
├── PermutationSort.Tests
│ ├── PermutationSort.Tests.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── UnitTest1.cs
│ └── packages.config
├── RadixSort.Tests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── RadixSort.Tests.csproj
│ ├── UnitTest1.cs
│ └── packages.config
├── SelectionSort1.Tests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SelectionSort1.Tests.csproj
│ ├── UnitTest1.cs
│ └── packages.config
├── SelectionSort2.Tests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SelectionSort2.Tests.csproj
│ ├── UnitTest1.cs
│ └── packages.config
├── SetSort1.Tests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SetSort1.Tests.csproj
│ ├── UnitTest1.cs
│ └── packages.config
├── SetSort2.Tests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SetSort2.Tests.csproj
│ ├── UnitTest1.cs
│ └── packages.config
├── Settings.StyleCop
├── ShakerSort.Tests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ShakerSort.Tests.csproj
│ ├── UnitTest1.cs
│ └── packages.config
├── ShellSort.Tests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ShellSort.Tests.csproj
│ ├── UnitTest1.cs
│ └── packages.config
├── ShellSort2.Tests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ShellSort2.Tests.csproj
│ ├── UnitTest1.cs
│ └── packages.config
├── SortingAlgorithms.Tests.sln
├── SortingAlgorithms.sln
└── SortingAlgorithms
│ ├── BitwiseSort
│ ├── BitwiseSort.csproj
│ ├── BitwiseSortAlgorithm.cs
│ ├── Element.cs
│ ├── NodeElement.cs
│ ├── app.config
│ └── packages.config
│ ├── BitwiseSort2
│ ├── BitwiseSort2.csproj
│ ├── BitwiseSortAlgorithm.cs
│ ├── Element.cs
│ └── packages.config
│ ├── BubbleSort
│ ├── BubbleSort.csproj
│ ├── BubbleSortingAlgorithm.cs
│ ├── Element.cs
│ └── packages.config
│ ├── BubbleSort2
│ ├── BubbleSort2.csproj
│ ├── BubbleSortingAlgorithm2.cs
│ ├── Element.cs
│ └── packages.config
│ ├── CombSort
│ ├── CombSorter.cs
│ ├── CombSorter.csproj
│ ├── Element.cs
│ └── packages.config
│ ├── CountSort
│ ├── CountSorter.cs
│ ├── CountSorter.csproj
│ └── packages.config
│ ├── CountSorter2
│ ├── CountSorter2.cs
│ ├── CountSorter2.csproj
│ ├── Element.cs
│ ├── List.cs
│ └── packages.config
│ ├── HeapSort
│ ├── Element.cs
│ ├── HeapSort.cs
│ ├── HeapSort.csproj
│ └── packages.config
│ ├── InsertionSort
│ ├── App.config
│ ├── Element.cs
│ ├── InsertionSort.cs
│ ├── InsertionSort.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
│ ├── InsertionSort2
│ ├── App.config
│ ├── Element.cs
│ ├── InsertionSort2.csproj
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
│ ├── InsertionSort3
│ ├── App.config
│ ├── Element.cs
│ ├── InsertionSort3.csproj
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
│ ├── PermutationSort
│ ├── App.config
│ ├── Element.cs
│ ├── PermutationSort.csproj
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
│ ├── RadixSort
│ ├── Element.cs
│ ├── RadixSort.cs
│ ├── RadixSort.csproj
│ └── packages.config
│ ├── SelectionSort1
│ ├── Element.cs
│ ├── SelectionSort.cs
│ ├── SelectionSort1.csproj
│ └── packages.config
│ ├── SelectionSort2
│ ├── Element.cs
│ ├── SelectionSort.cs
│ ├── SelectionSort2.csproj
│ └── packages.config
│ ├── SetSort1
│ ├── SetSort.cs
│ ├── SetSort1.csproj
│ └── packages.config
│ ├── SetSort2
│ ├── Element.cs
│ ├── Program.cs
│ ├── SetSort2.csproj
│ └── packages.config
│ ├── ShakerSort
│ ├── Element.cs
│ ├── Program.cs
│ ├── ShakerSort.csproj
│ └── packages.config
│ ├── ShellSort
│ ├── Element.cs
│ ├── Program.cs
│ ├── ShellSort.csproj
│ └── packages.config
│ └── ShellSort2
│ ├── Element.cs
│ ├── Program.cs
│ ├── ShellSort2.csproj
│ └── packages.config
├── Chapter 04 - Searching Algorithms
├── BinarySearch.Iterative
│ ├── BinarySearch.Iterative.csproj
│ ├── BinarySearchIterative.cs
│ ├── Element.cs
│ └── packages.config
├── BinarySearch.Recursive
│ ├── BinarySearch.Recursive.csproj
│ ├── BinarySearchRecursive.cs
│ ├── Element.cs
│ └── packages.config
├── BinarySearch.UsingBitwiseOperations
│ ├── BinarySearch.UsingBitwiseOperations.csproj
│ ├── BinarySearchUsingBitOperations.cs
│ ├── Element.cs
│ └── packages.config
├── BinarySearch.UsingBitwiseOperations2
│ ├── BinarySearch.UsingBitwiseOperations2.csproj
│ ├── BinarySearchUsingBitOperations2.cs
│ ├── Element.cs
│ └── packages.config
├── BinarySearch.WithoutCycles
│ ├── BinarySearch.WithoutCycles.csproj
│ ├── BinarySearchWithoutCycles.cs
│ ├── Element.cs
│ └── packages.config
├── FibunacciSearch
│ ├── Element.cs
│ ├── FibunacciSearch.cs
│ ├── FibunacciSearch.csproj
│ └── packages.config
├── InterpolSearch
│ ├── Element.cs
│ ├── InterpolSearch.cs
│ ├── InterpolSearch.csproj
│ └── packages.config
├── JumpSearch
│ ├── Element.cs
│ ├── JumpSearch.csproj
│ ├── JumpSearchAlgorithm.cs
│ └── packages.config
├── ReorderSearchingAlgorithm
│ ├── Element.cs
│ ├── ReorderAlgorithm.cs
│ ├── ReorderSearchingAlgorithm.csproj
│ └── packages.config
├── SearchingAlgorithms.sln
├── SequentialSearchAlgorithm
│ ├── Element.cs
│ ├── SeqentialSearchAlgorithm.cs
│ ├── SequentialSearchAlgorithm.csproj
│ └── packages.config
└── Settings.StyleCop
├── Chapter 05 - Graph Theory
├── GraphTheory
│ ├── A-Center
│ │ ├── A-Center.csproj
│ │ ├── ACenter.cs
│ │ └── packages.config
│ ├── AllSimplePaths
│ │ ├── AllSimplePaths.cs
│ │ ├── AllSimplePaths.csproj
│ │ └── packages.config
│ ├── ArticPoints
│ │ ├── ArticPoints.cs
│ │ ├── ArticPoints.csproj
│ │ └── packages.config
│ ├── BreadthFirstSearch
│ │ ├── BreadthFirstSearch.cs
│ │ ├── BreadthFirstSearch.csproj
│ │ └── packages.config
│ ├── CompanyControl
│ │ ├── CompanyControl.cs
│ │ ├── CompanyControl.csproj
│ │ └── packages.config
│ ├── CyclicGraphCheck
│ │ ├── CyclicGraphCheck.cs
│ │ ├── CyclicGraphCheck.csproj
│ │ └── packages.config
│ ├── DepthFirstSearch
│ │ ├── DepthFirstSearch.cs
│ │ ├── DepthFirstSearch.csproj
│ │ └── packages.config
│ ├── DijkstraAlgorithm
│ │ ├── DijkstraAlgorithm.cs
│ │ ├── DijkstraAlgorithm.csproj
│ │ └── packages.config
│ ├── EulerCycle
│ │ ├── EulerCycle.cs
│ │ ├── EulerCycle.csproj
│ │ └── packages.config
│ ├── FloydAlgorithm
│ │ ├── FloydAlgorithm.cs
│ │ ├── FloydAlgorithm.csproj
│ │ └── packages.config
│ ├── FordFulkersonAlgorithm
│ │ ├── FordFulkersonAlgorithm.cs
│ │ ├── FordFulkersonAlgorithm.csproj
│ │ └── packages.config
│ ├── FullTopologicalSort
│ │ ├── FullTopologicalSort.csproj
│ │ ├── FullTopologicalSorter.cs
│ │ └── packages.config
│ ├── FundamentalCycles
│ │ ├── FundamentalCycles.cs
│ │ ├── FundamentalCycles.csproj
│ │ └── packages.config
│ ├── GraphComponents
│ │ ├── GraphComponents.cs
│ │ ├── GraphComponents.csproj
│ │ └── packages.config
│ ├── GraphTheory.sln
│ ├── KruskalAlgorithm
│ │ ├── Arc.cs
│ │ ├── KruskalAlgorithm.cs
│ │ ├── KruskalAlgorithm.csproj
│ │ └── packages.config
│ ├── LongestPath
│ │ ├── LongestPath.cs
│ │ ├── LongestPath.csproj
│ │ └── packages.config
│ ├── MaximalIndependentSets
│ │ ├── MaximalIndependentSets.cs
│ │ ├── MaximalIndependentSets.csproj
│ │ └── packages.config
│ ├── MinimalDominatingSets
│ │ ├── MinimalDominatingSets.cs
│ │ ├── MinimalDominatingSets.csproj
│ │ └── packages.config
│ ├── MinimalHamiltonianCycle
│ │ ├── MinimalHamiltonianCycle.cs
│ │ ├── MinimalHamiltonianCycle.csproj
│ │ └── packages.config
│ ├── P-Center
│ │ ├── P-Center.csproj
│ │ ├── PCenter.cs
│ │ └── packages.config
│ ├── PrimAlgorithm
│ │ ├── PrimAlgorithm.cs
│ │ ├── PrimAlgorithm.csproj
│ │ └── packages.config
│ ├── Settings.StyleCop
│ ├── ShortestPath
│ │ ├── ShortestPath.cs
│ │ ├── ShortestPath.csproj
│ │ └── packages.config
│ ├── StronglyConnectedComponents
│ │ ├── StronglyConnectedComponents.cs
│ │ ├── StronglyConnectedComponents.csproj
│ │ └── packages.config
│ ├── TopologicalSort
│ │ ├── TopologicalSort.csproj
│ │ ├── TopologicalSorter.cs
│ │ └── packages.config
│ ├── TransitiveOrientation
│ │ ├── TransitiveOrientation.cs
│ │ ├── TransitiveOrientation.csproj
│ │ └── packages.config
│ └── VerticesBase
│ │ ├── VerticesBase.csproj
│ │ ├── VerticesBaseFinder.cs
│ │ └── packages.config
└── Translations.xlsx
├── Chapter 06 - NP-Complete
├── BooleanSatisfiability
│ ├── BooleanSatisfiability.csproj
│ ├── Program.cs
│ ├── boolcut.cs
│ └── packages.config
├── Chapter6.sln
├── Examples
│ ├── Examples.csproj
│ ├── Program.cs
│ └── packages.config
├── GraphColoring
│ ├── GraphColoring.csproj
│ ├── Program.cs
│ └── packages.config
├── KinightsTour
│ ├── KinightsTour.csproj
│ ├── Program.cs
│ └── packages.config
├── KnapsackProblem
│ ├── KnapsackProblem.csproj
│ ├── Program.cs
│ └── packages.config
├── LetterTranslation
│ ├── LetterTranslation.csproj
│ ├── Program.cs
│ ├── TranslationType.cs
│ └── packages.config
├── LongestPathProblem
│ ├── LongestPathProblem.csproj
│ ├── Program.cs
│ └── packages.config
├── SchoolSchedule
│ ├── Program.cs
│ ├── SchoolSchedule.csproj
│ └── packages.config
├── Settings.StyleCop
├── SevenQueensProblem
│ ├── Program.cs
│ ├── SevenQueensProblem.csproj
│ └── packages.config
└── TicTacToe
│ ├── TicTacToe.cs
│ ├── TicTacToe.csproj
│ └── packages.config
├── Chapter 07 - Divide And Conquer
├── BinaryMerger
│ ├── BinaryMerge.csproj
│ ├── BinaryMerger.cs
│ ├── Element.cs
│ └── packages.config
├── DevideAndConquer.sln
├── FastPow
│ ├── FastPow.cs
│ ├── FastPow.csproj
│ └── packages.config
├── FindKthBiggestElement
│ ├── FindKthBiggestElement.cs
│ ├── FindKthBiggestElement.csproj
│ └── packages.config
├── FindKthMiddleElement
│ ├── FindKthMiddleElement.cs
│ ├── FindKthMiddleElement.csproj
│ └── packages.config
├── FindKthMiddleElement2
│ ├── FindKthMiddleElement2.cs
│ ├── FindKthMiddleElement2.csproj
│ └── packages.config
├── Majorant1
│ ├── Majorant1.cs
│ ├── Majorant1.csproj
│ └── packages.config
├── Majorant10
│ ├── Majorant10.cs
│ ├── Majorant10.csproj
│ └── packages.config
├── Majorant11
│ ├── Majorant11.cs
│ ├── Majorant11.csproj
│ └── packages.config
├── Majorant12FindWithStack
│ ├── Majorant12FindWithStack.cs
│ ├── Majorant12FindWithStack.csproj
│ └── packages.config
├── Majorant13
│ ├── Majorant13.cs
│ ├── Majorant13.csproj
│ └── packages.config
├── Majorant2
│ ├── Majorant2.cs
│ ├── Majorant2.csproj
│ └── packages.config
├── Majorant3
│ ├── Majorant3.cs
│ ├── Majorant3.csproj
│ └── packages.config
├── Majorant4
│ ├── Majorant4.cs
│ ├── Majorant4.csproj
│ └── packages.config
├── Majorant5
│ ├── Majorant5.cs
│ ├── Majorant5.csproj
│ └── packages.config
├── Majorant6
│ ├── Majorant6.cs
│ ├── Majorant6.csproj
│ └── packages.config
├── Majorant7
│ ├── Majorant7.cs
│ ├── Majorant7.csproj
│ └── packages.config
├── Majorant8
│ ├── Majorant8.cs
│ ├── Majorant8.csproj
│ └── packages.config
├── Majorant9
│ ├── Majorant9.cs
│ ├── Majorant9.csproj
│ └── packages.config
├── MergeSortIterative
│ ├── MergeSortIterative.cs
│ ├── MergeSortIterative.csproj
│ ├── Node.cs
│ └── packages.config
├── MergeSortLinkedList
│ ├── MergeSortLinkedList.cs
│ ├── MergeSortLinkedList.csproj
│ ├── Node.cs
│ └── packages.config
├── MergeSorter
│ ├── MergeSorter.cs
│ ├── MergeSorter.csproj
│ └── packages.config
├── MergesortLinkedListDoubleStep
│ ├── MergesortLinkedListDoubleStep.cs
│ ├── MergesortLinkedListDoubleStep.csproj
│ ├── Node.cs
│ └── packages.config
├── MergingSortedArrays
│ ├── CList.cs
│ ├── Element.cs
│ ├── MergingSortedArrays.cs
│ ├── MergingSortedArrays.csproj
│ └── packages.config
├── MinAndMaxElement
│ ├── MinAndMaxElement.cs
│ ├── MinAndMaxElement.csproj
│ └── packages.config
├── Settings.StyleCop
├── Shift1
│ ├── Element.cs
│ ├── Shift1.cs
│ ├── Shift1.csproj
│ └── packages.config
├── Shift2
│ ├── Element.cs
│ ├── Shift2.cs
│ ├── Shift2.csproj
│ └── packages.config
├── Shift3
│ ├── Element.cs
│ ├── Shift3.cs
│ ├── Shift3.csproj
│ └── packages.config
├── SolveHanoyTowers
│ ├── SolveHanoyTowers.cs
│ ├── SolveHanoyTowers.csproj
│ └── packages.config
├── Tournament3
│ ├── Tournament3.cs
│ ├── Tournament3.csproj
│ └── packages.config
├── TournamentForAllNums
│ ├── TournamentForAllNums.cs
│ ├── TournamentForAllNums.csproj
│ └── packages.config
├── TournamentPowerOf2
│ ├── TournamentPowerOf2.cs
│ ├── TournamentPowerOf2.csproj
│ └── packages.config
└── Translations.xlsx
├── Chapter 08 - Dynamic Programming
├── Alanbob
│ ├── Alanbob.csproj
│ ├── alanbob.cs
│ └── packages.config
├── Alanbob2
│ ├── Alanbob2.csproj
│ ├── alanbob2.cs
│ └── packages.config
├── Binom
│ ├── Binom.csproj
│ ├── binom.cs
│ └── packages.config
├── Binom2
│ ├── Binom2.csproj
│ ├── binom2.cs
│ └── packages.config
├── Board
│ ├── Board.csproj
│ ├── board.cs
│ └── packages.config
├── BreakNum
│ ├── BreakNum.csproj
│ ├── breaknum.cs
│ └── packages.config
├── Catalan
│ ├── Catalan.csproj
│ ├── Position.cs
│ ├── catalan.cs
│ └── packages.config
├── Cfl
│ ├── Cfl.csproj
│ ├── NonTerminalProduction.cs
│ ├── Production.cs
│ ├── cfl.cs
│ └── packages.config
├── Chapter 8.sln
├── CoinMin
│ ├── CoinMin.cs
│ ├── CoinMin.csproj
│ └── packages.config
├── CoinMin2
│ ├── CoinMin2.csproj
│ ├── Coinmin2.cs
│ ├── app.config
│ └── packages.config
├── Coins
│ ├── Coins.csproj
│ ├── Element.cs
│ ├── coins.cs
│ └── packages.config
├── ConferenceRoom
│ ├── BeginEnd.cs
│ ├── BlueRed.cs
│ ├── ConferenceRoom.cs
│ ├── ConferenceRoom.csproj
│ └── packages.config
├── Cuts
│ ├── Cuts.csproj
│ ├── Element.cs
│ ├── cuts.cs
│ └── packages.config
├── Domino
│ ├── Domino.csproj
│ ├── domino.cs
│ └── packages.config
├── Fibmatr
│ ├── Fibmatr.csproj
│ ├── fibmatr.cs
│ └── packages.config
├── Fibmemo
│ ├── Fibmemo.csproj
│ ├── fibmemo.cs
│ └── packages.config
├── Fibmemo2
│ ├── Fibmemo2.csproj
│ ├── fibmemo2.cs
│ └── packages.config
├── Fibrec
│ ├── Fibrec.csproj
│ ├── fibrec.cs
│ └── packages.config
├── Hedonia
│ ├── Hedonia.csproj
│ ├── hedonia.cs
│ └── packages.config
├── JaggedSequence
│ ├── JaggedSequence.cs
│ ├── JaggedSequence.csproj
│ └── packages.config
├── Knapsack1
│ ├── Knapsack1.csproj
│ ├── knapsack1.cs
│ └── packages.config
├── Knapsack2a
│ ├── Knapsack2a.csproj
│ ├── knapsack2a.cs
│ └── packages.config
├── Knapsack2b
│ ├── Knapsack2b.csproj
│ ├── knapsack2b.cs
│ └── packages.config
├── Knapsack3a
│ ├── Knapsack3a.csproj
│ ├── knapsack3a.cs
│ └── packages.config
├── Knapsack3b
│ ├── Knapsack3b.csproj
│ ├── knapsack3b.cs
│ └── packages.config
├── Knapsack3c
│ ├── Knapsack3c.csproj
│ ├── knapsack3c.cs
│ └── packages.config
├── Knapsack4
│ ├── Knapsack4.csproj
│ ├── knapsack4.cs
│ └── packages.config
├── Knapsack5
│ ├── Knapsack5.csproj
│ ├── knapsack5.cs
│ └── packages.config
├── LongestCommonSubsequence1
│ ├── LongestCommonSubsequence1.csproj
│ ├── Program.cs
│ └── packages.config
├── LongestCommonSubsequence2
│ ├── LongestCommonSubsequence2.csproj
│ ├── Program.cs
│ └── packages.config
├── LongestNonDecreasingSubsequence1
│ ├── LongestNonDecreasingSubsequence1.csproj
│ ├── Program.cs
│ └── packages.config
├── LongestNonDecreasingSubsequence2
│ ├── LongestNonDecreasingSubsequence2.csproj
│ ├── Program.cs
│ └── packages.config
├── LongestNonDecreasingSubsequence3
│ ├── LongestNonDecreasingSubsequence3.csproj
│ ├── Program.cs
│ └── packages.config
├── MatrixMultiplication1
│ ├── MatrixMultiplication1.csproj
│ ├── Program.cs
│ └── packages.config
├── MatrixMultiplication2
│ ├── MatrixMultiplication2.csproj
│ ├── Program.cs
│ └── packages.config
├── MatrixMultiplication3
│ ├── MatrixMultiplication3.csproj
│ ├── Order.cs
│ ├── Program.cs
│ └── packages.config
├── NoTwoZeroes
│ ├── NoTwoZeroes.csproj
│ ├── Program.cs
│ └── packages.config
├── OptimalBinarySearchTree
│ ├── OptimalBinarySearchTree.csproj
│ ├── Program.cs
│ └── packages.config
├── OptimalBitonicSequence
│ ├── OptimalBitonicSequence.csproj
│ ├── Program.cs
│ ├── St.cs
│ └── packages.config
├── Partitioning
│ ├── Partitioning.csproj
│ ├── Program.cs
│ └── packages.config
├── RailwayTickets
│ ├── Program.cs
│ ├── RailwayTickets.csproj
│ └── packages.config
├── ResourceDistribution
│ ├── Program.cs
│ ├── ResourceDistribution.csproj
│ └── packages.config
├── RingExpression
│ ├── Goal.cs
│ ├── Program.cs
│ ├── RingExpression.csproj
│ └── packages.config
├── Settings.StyleCop
├── SportSeries1
│ ├── Program.cs
│ ├── SportSeries1.csproj
│ └── packages.config
├── SportSeries2
│ ├── Program.cs
│ ├── SportSeries2.csproj
│ └── packages.config
├── SportSeries3
│ ├── SportSeries3.cs
│ ├── SportSeries3.csproj
│ └── packages.config
├── SportSeries4
│ ├── Program.cs
│ ├── SportSeries4.csproj
│ └── packages.config
├── StringTransform
│ ├── Program.cs
│ ├── StringTransform.csproj
│ └── packages.config
├── SymbolicMultiplication
│ ├── Program.cs
│ ├── SymbolicMultiplication.csproj
│ └── packages.config
├── Taxi
│ ├── Dist.cs
│ ├── Program.cs
│ ├── Taxi.csproj
│ └── packages.config
├── TicketQueue
│ ├── Program.cs
│ ├── TicketQueue.csproj
│ └── packages.config
└── filelist.txt
├── Chapter 09 - Heuristic And Probabilistic Algorithms
├── ActivityScheduling
│ ├── ActivityScheduling.cs
│ ├── ActivityScheduling.csproj
│ └── packages.config
├── Chapter 9.sln
├── EgyptianFractions
│ ├── EgyptianFractions.cs
│ ├── EgyptianFractions.csproj
│ └── packages.config
├── FractionalKnapsack
│ ├── FractionalKnapsack.cs
│ ├── FractionalKnapsack.csproj
│ └── packages.config
├── GraphColoring
│ ├── GraphColoring.cs
│ ├── GraphColoring.csproj
│ └── packages.config
├── GuessingPi
│ ├── GuessingPi.cs
│ ├── GuessingPi.csproj
│ └── packages.config
├── HamiltonianCycleGrayCodes
│ ├── HamiltonianCycleGrayCodes.cs
│ ├── HamiltonianCycleGrayCodes.csproj
│ └── packages.config
├── KnightsTour
│ ├── KnightsTour.cs
│ ├── KnightsTour.csproj
│ └── packages.config
├── PrimeMonteCarlo
│ ├── PrimeMonteCarlo.cs
│ ├── PrimeMonteCarlo.csproj
│ └── packages.config
├── Scheduling
│ ├── Scheduling.cs
│ ├── Scheduling.csproj
│ └── packages.config
├── Settings.StyleCop
├── TravellingSalesmanGenetic
│ ├── TravellingSalesmanGenetic.cs
│ ├── TravellingSalesmanGenetic.csproj
│ └── packages.config
└── filelist.txt
├── Chapter 10 - Compression
├── ArithmeticCoding
│ ├── ArithmeticCoding.cs
│ ├── ArithmeticCoding.csproj
│ ├── Symbol.cs
│ └── packages.config
├── Chapter 10.sln
├── Entropy
│ ├── Entropy.cs
│ ├── Entropy.csproj
│ └── packages.config
├── Huffman1
│ ├── Huffman1.cs
│ ├── Huffman1.csproj
│ ├── Tree.cs
│ └── packages.config
├── Huffman2
│ ├── Huffman2.cs
│ ├── Huffman2.csproj
│ ├── Tree.cs
│ └── packages.config
├── Huffman3
│ ├── HeapForest.cs
│ ├── Huffman3.cs
│ ├── Huffman3.csproj
│ ├── Tree.cs
│ └── packages.config
├── LempelZiwWelch
│ ├── LempelZiwWelch.cs
│ ├── LempelZiwWelch.csproj
│ └── packages.config
├── LinearPredictionCoding
│ ├── LinearPredictionCoding.cs
│ ├── LinearPredictionCoding.csproj
│ └── packages.config
├── Settings.StyleCop
└── filelist.txt
├── README.md
└── changeDotNet.ps1
/Chapter 01 - Introduction To Algorithms/DevNumber1.Tests/DevNumber1Tests.cs:
--------------------------------------------------------------------------------
1 | namespace DevNumber1.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class DevNumber1Tests
7 | {
8 | [Test]
9 | public void DevNumTest()
10 | {
11 | Assert.Fail();
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/DevNumber1.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/BaseConversions/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/BellNumbers/BellNumbers.cs:
--------------------------------------------------------------------------------
1 | namespace BellNumbers
2 | {
3 | using System;
4 |
5 | public class BellNumbers
6 | {
7 | private const int MaxN = 100;
8 | private const ulong N = 10;
9 |
10 | private static ulong[] m = new ulong[MaxN + 1];
11 |
12 | internal static void Main()
13 | {
14 | Stirling(N);
15 | Console.WriteLine("Bell({0}) = {1}", N, Bell(N));
16 | }
17 |
18 | private static void Stirling(ulong n)
19 | {
20 | if (n == 0)
21 | {
22 | m[0] = 1;
23 | }
24 | else
25 | {
26 | m[0] = 0;
27 | }
28 |
29 | for (ulong i = 1; i <= n; i++)
30 | {
31 | m[i] = 1;
32 |
33 | for (ulong j = i - 1; j >= 1; j--)
34 | {
35 | m[j] = (j * m[j]) + m[j - 1];
36 | }
37 | }
38 | }
39 |
40 | private static ulong Bell(ulong n)
41 | {
42 | ulong result = 0;
43 | for (ulong i = 0; i <= n; i++)
44 | {
45 | result += m[i];
46 | }
47 |
48 | return result;
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/BellNumbers/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/BinomialCoefficientCalculator/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/CombinationsGenerator/CombinationsGenerator.cs:
--------------------------------------------------------------------------------
1 | namespace CombinationsGenerator
2 | {
3 | using System;
4 |
5 | public class CombinationsGenerator
6 | {
7 | private const uint N = 5;
8 | private const uint K = 3;
9 |
10 | private static readonly uint[] Combination = new uint[K];
11 |
12 | internal static void Main()
13 | {
14 | Console.WriteLine("C({0}, {1}): ", N, K);
15 | GenerateCombinations(1, 0);
16 | }
17 |
18 | private static void Print()
19 | {
20 | for (uint i = 0; i < K; i++)
21 | {
22 | Console.Write("{0} ", Combination[i]);
23 | }
24 |
25 | Console.WriteLine();
26 | }
27 |
28 | private static void GenerateCombinations(uint i, uint after)
29 | {
30 | if (i > K)
31 | {
32 | return;
33 | }
34 |
35 | for (uint j = after + 1; j <= N; j++)
36 | {
37 | Combination[i - 1] = j;
38 | if (i == K)
39 | {
40 | Print();
41 | }
42 |
43 | GenerateCombinations(i + 1, j);
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/CombinationsGenerator/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/DevNumber1/DevNumber1.cs:
--------------------------------------------------------------------------------
1 | namespace DevNumber1
2 | {
3 | using System;
4 |
5 | public class DevNumber1
6 | {
7 | private const int Number = 7;
8 | private static int[] mp = new int[Number + 1];
9 |
10 | public static void DevNum(int n, int pos)
11 | {
12 | if (n == 0)
13 | {
14 | Print(pos - 1);
15 | }
16 | else
17 | {
18 | for (int k = n; k >= 1; k--)
19 | {
20 | mp[pos] = k;
21 | if (mp[pos] <= mp[pos - 1])
22 | {
23 | DevNum(n - k, pos + 1);
24 | }
25 | }
26 | }
27 | }
28 |
29 | internal static void Main()
30 | {
31 | mp[0] = Number + 1;
32 | DevNum(Number, 1);
33 | }
34 |
35 | private static void Print(int length)
36 | {
37 | for (int i = 1; i < length; i++)
38 | {
39 | Console.Write("{0} + ", mp[i]);
40 | }
41 |
42 | Console.WriteLine("{0}", mp[length]);
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/DevNumber1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/DevNumber2/DevNumber2.cs:
--------------------------------------------------------------------------------
1 | namespace DevNumber2
2 | {
3 | using System;
4 |
5 | public class DevNumber2
6 | {
7 | private const int MaxLn = 20; // Множители: най-много log2n (минималният е 2)
8 | private const int Number = 50; // Число, което ще разбиваме
9 |
10 | private static int[] mp = new int[MaxLn];
11 |
12 | internal static void Main()
13 | {
14 | mp[0] = Number + 1;
15 | DevNum(Number, 1);
16 | }
17 |
18 | private static void Print(int length)
19 | {
20 | for (int i = 1; i < length; i++)
21 | {
22 | Console.Write("{0} * ", mp[i]);
23 | }
24 |
25 | Console.WriteLine("{0}", mp[length]);
26 | }
27 |
28 | private static void DevNum(int n, int pos)
29 | {
30 | if (n == 1)
31 | {
32 | Print(pos - 1);
33 | }
34 | else
35 | {
36 | for (int k = n; k > 1; k--)
37 | {
38 | mp[pos] = k;
39 | if ((mp[pos] <= mp[pos - 1]) && (n % k == 0))
40 | {
41 | DevNum(n / k, pos + 1);
42 | }
43 | }
44 | }
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/DevNumber2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/DevNumber3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/DigitsCountOfANumber/DigitsCountOfANumber.cs:
--------------------------------------------------------------------------------
1 | namespace DigitsCountOfANumber
2 | {
3 | using System;
4 |
5 | public class DigitsCountOfANumber
6 | {
7 | private static uint number = 4242;
8 |
9 | internal static void Main()
10 | {
11 | uint digits = 0;
12 | uint n = number;
13 | for (; n > 0; n /= 10, digits++)
14 | {
15 | }
16 |
17 | Console.WriteLine("Броят на цифрите на {0} е {1}", number, digits);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/DigitsCountOfANumber/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/DigitsOfNFactorial/DigitsOfNFactorial.cs:
--------------------------------------------------------------------------------
1 | namespace DigitsOfNFactorial
2 | {
3 | using System;
4 |
5 | public class DigitsOfNFactorial
6 | {
7 | private const uint N = 123;
8 |
9 | internal static void Main()
10 | {
11 | double digitsCount = 0;
12 | for (int i = 1; i <= N; i++)
13 | {
14 | digitsCount += Math.Log(i, 10);
15 | }
16 |
17 | Console.WriteLine("Броят на цифрите на {0}! е {1}", N, (ulong)digitsCount + 1);
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/DigitsOfNFactorial/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/FactorialCalculator/FactorialCalculator.cs:
--------------------------------------------------------------------------------
1 | namespace FactorialCalculator
2 | {
3 | using System;
4 |
5 | public class FactorialCalculator
6 | {
7 | internal static void Main()
8 | {
9 | Console.Write("Въведете N: ");
10 | uint n = uint.Parse(Console.ReadLine());
11 | ulong factorial = GetFactorial(n);
12 | Console.WriteLine("{0}! = {1}", n, factorial);
13 | }
14 |
15 | private static ulong GetFactorial(uint n)
16 | {
17 | ulong factorial = 1UL;
18 | for (uint i = 2; i <= n; i++)
19 | {
20 | factorial *= i;
21 | }
22 |
23 | return factorial;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/FactorialCalculator/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/FactorialZeroesCountAtTheEnd/FactorialTrailingZeroesFinder.cs:
--------------------------------------------------------------------------------
1 | namespace FactorialZeroesCountAtTheEnd
2 | {
3 | using System;
4 |
5 | public class FactorialTrailingZeroesFinder
6 | {
7 | private const uint N = 10;
8 |
9 | internal static void Main()
10 | {
11 | uint zeroesCount = 0;
12 | uint p = 5;
13 | while (N >= p)
14 | {
15 | zeroesCount += N / p;
16 | p *= 5;
17 | }
18 |
19 | Console.WriteLine("Броят на нулите в края на {0}! е {1}", N, zeroesCount);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/FactorialZeroesCountAtTheEnd/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/FastRecursiveFactorialCalculator/FastRecursiveFactorialCalculator.cs:
--------------------------------------------------------------------------------
1 | namespace FastRecursiveFactorialCalculator
2 | {
3 | using System;
4 |
5 | public class FastRecursiveFactorialCalculator
6 | {
7 | private const uint N = 6;
8 | private static uint i = 0;
9 |
10 | internal static void Main()
11 | {
12 | i = N + 1;
13 | Console.WriteLine("{0}! = {1}", N, GetFactorial());
14 | }
15 |
16 | private static ulong GetFactorial()
17 | {
18 | if (i == 1)
19 | {
20 | return 1;
21 | }
22 |
23 | return --i * GetFactorial();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/FastRecursiveFactorialCalculator/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/FillingAndPrintingMatrix/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/GetPowerOfANumber/GetPowerOfANumber.cs:
--------------------------------------------------------------------------------
1 | namespace GetPowerOfANumber
2 | {
3 | using System;
4 |
5 | public class GetPowerOfANumber
6 | {
7 | internal static void Main()
8 | {
9 | Console.Write("Въведете основа x: ");
10 | double number = double.Parse(Console.ReadLine());
11 | Console.Write("Въведете стенеп y: ");
12 | uint power = uint.Parse(Console.ReadLine());
13 | double result = GetPower(number, power);
14 | Console.WriteLine("{0} повдигнато на степен {1} e {2}", number, power, result);
15 | }
16 |
17 | private static double GetPower(double number, uint power)
18 | {
19 | double result = number;
20 | for (uint i = 1; i < power; i++)
21 | {
22 | result *= number;
23 | }
24 |
25 | return result;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/GetPowerOfANumber/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/IterativeFibonacci/IterativeFibonacci.cs:
--------------------------------------------------------------------------------
1 | namespace IterativeFibonacci
2 | {
3 | using System;
4 |
5 | public class IterativeFibonacci
6 | {
7 | private const uint N = 7;
8 |
9 | internal static void Main()
10 | {
11 | Console.WriteLine("Fibonacci({0}) = {1}", N, GetFibonacciNumber2(N));
12 | }
13 |
14 | // Пресмята n-тото число на Фибоначи, използвайки три променливи
15 | private static ulong GetFibonacciNumber1(uint n)
16 | {
17 | ulong fn = 1, fn1 = 0, fn2 = 0;
18 | while (n-- > 0)
19 | {
20 | fn2 = fn1;
21 | fn1 = fn;
22 | fn = fn1 + fn2;
23 | }
24 |
25 | return fn1;
26 | }
27 |
28 | // Пресмята n-тото число на Фибоначи, използвайки две променливи
29 | private static ulong GetFibonacciNumber2(uint n)
30 | {
31 | ulong f1 = 0, f2 = 1;
32 | while (n-- > 0)
33 | {
34 | f2 = f1 + f2;
35 | f1 = f2 - f1;
36 | }
37 |
38 | return f1;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/IterativeFibonacci/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/IterativeGreatestCommonDivisor/IterativeGreatestCommonDivisor.cs:
--------------------------------------------------------------------------------
1 | namespace IterativeGreatestCommonDivisor
2 | {
3 | using System;
4 |
5 | public class IterativeGreatestCommonDivisor
6 | {
7 | private const uint A = 24;
8 | private const uint B = 108;
9 |
10 | internal static void Main()
11 | {
12 | Console.WriteLine(
13 | "Най-големият общ делител на {0} и {1} е {2}",
14 | A,
15 | B,
16 | GetGreatestCommonDivisor(A, B));
17 | }
18 |
19 | private static uint GetGreatestCommonDivisor(uint a, uint b)
20 | {
21 | uint swap = 0;
22 | while (b > 0)
23 | {
24 | swap = b;
25 | b = a % b;
26 | a = swap;
27 | }
28 |
29 | return a;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/IterativeGreatestCommonDivisor/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/IterativePrint/IterativePrint.cs:
--------------------------------------------------------------------------------
1 | namespace IterativePrint
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | public class IterativePrint
7 | {
8 | private const uint N = 7892;
9 |
10 | internal static void Main()
11 | {
12 | Stack digits = new Stack();
13 | uint number = N;
14 | while (number > 0)
15 | {
16 | digits.Push(number % 10);
17 | number /= 10;
18 | }
19 |
20 | while (digits.Count > 0)
21 | {
22 | Console.Write(digits.Pop());
23 | }
24 |
25 | Console.WriteLine();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/IterativePrint/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/LeastCommonMultiple/LeastCommonMultiple.cs:
--------------------------------------------------------------------------------
1 | namespace LeastCommonMultiple
2 | {
3 | using System;
4 |
5 | public class LeastCommonMultiple
6 | {
7 | private const uint N = 4;
8 | private static readonly uint[] A = { 10, 8, 5, 9 };
9 |
10 | internal static void Main()
11 | {
12 | Console.WriteLine(GetLeastCommonMultiple(A, N));
13 | }
14 |
15 | private static uint GetGreatestCommonDivisor(uint a, uint b)
16 | {
17 | return (b == 0) ? a : GetGreatestCommonDivisor(b, a % b);
18 | }
19 |
20 | private static uint GetLeastCommonMultiple(uint[] a, uint n)
21 | {
22 | if (n == 2)
23 | {
24 | return (a[0] * a[1]) / GetGreatestCommonDivisor(a[0], a[1]);
25 | }
26 | else
27 | {
28 | uint b = GetLeastCommonMultiple(a, n - 1);
29 | return (a[n - 1] * b) / GetGreatestCommonDivisor(a[n - 1], b);
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/LeastCommonMultiple/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/ListPreprocessedPrimeNumbersFinder/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/MatrixMultiplication/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/MersennePrimeNumbersFinder/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PascalTriangle/PascalTriangle.cs:
--------------------------------------------------------------------------------
1 | namespace PascalTriangle
2 | {
3 | using System;
4 |
5 | public class PascalTriangle
6 | {
7 | private const uint N = 7;
8 | private const uint K = 3;
9 | private static ulong[] lastLine = new ulong[N + 1];
10 |
11 | internal static void Main()
12 | {
13 | lastLine[0] = 1;
14 | for (uint i = 1; i <= N; i++)
15 | {
16 | lastLine[i] = 1;
17 | for (uint j = i - 1; j >= 1; j--)
18 | {
19 | lastLine[j] += lastLine[j - 1];
20 | }
21 | }
22 |
23 | Console.WriteLine("C({0}, {1}) = {2}", N, K, lastLine[K]);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PascalTriangle/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PermutationsCoding/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PermutationsGenerator/PermutationsGenerator.cs:
--------------------------------------------------------------------------------
1 | namespace PermutationsGenerator
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | public class PermutationsGenerator
7 | {
8 | private const uint N = 3;
9 |
10 | private static readonly uint[] Permutation = new uint[N];
11 | private static readonly HashSet Used = new HashSet();
12 |
13 | internal static void Main()
14 | {
15 | GeneratePermutations(0);
16 | }
17 |
18 | private static void Print()
19 | {
20 | for (int i = 0; i < N; i++)
21 | {
22 | Console.Write("{0} ", Permutation[i] + 1);
23 | }
24 |
25 | Console.WriteLine();
26 | }
27 |
28 | private static void GeneratePermutations(uint i)
29 | {
30 | if (i >= N)
31 | {
32 | Print();
33 | return;
34 | }
35 |
36 | for (uint k = 0; k < N; k++)
37 | {
38 | if (!Used.Contains(k))
39 | {
40 | Used.Add(k);
41 | Permutation[i] = k;
42 | GeneratePermutations(i + 1);
43 | Used.Remove(k);
44 | }
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PermutationsGenerator/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PermutationsGeneratorWithSwapping/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PreprocessedPrimeNumbersFinder/PreprocessedPrimeNumbersFinder.cs:
--------------------------------------------------------------------------------
1 | namespace PreprocessedPrimeNumbersFinder
2 | {
3 | using System;
4 |
5 | public class PreprocessedPrimeNumbersFinder
6 | {
7 | private const uint N = 23;
8 |
9 | private static uint[] primeNumbers =
10 | {
11 | 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,
12 | 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97
13 | };
14 |
15 | internal static void Main()
16 | {
17 | if (IsPrime(N))
18 | {
19 | Console.WriteLine("Числото {0} е просто.", N);
20 | }
21 | else
22 | {
23 | Console.WriteLine("Числото {0} е съставно.", N);
24 | }
25 | }
26 |
27 | private static bool IsPrime(uint number)
28 | {
29 | uint i = 0;
30 | while (i < primeNumbers.Length && primeNumbers[i] * primeNumbers[i] <= N)
31 | {
32 | if (N % primeNumbers[i] == 0)
33 | {
34 | return false;
35 | }
36 |
37 | i++;
38 | }
39 |
40 | return true;
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PreprocessedPrimeNumbersFinder/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PrimeFactorization/PrimeFactorization.cs:
--------------------------------------------------------------------------------
1 | namespace PrimeFactorization
2 | {
3 | using System;
4 |
5 | public class PrimeFactorization
6 | {
7 | // Число, което ще се разлага
8 | private static uint n = 435;
9 |
10 | internal static void Main()
11 | {
12 | Console.Write("{0} = ", n);
13 | uint i = 1;
14 | while (n != 1)
15 | {
16 | i++;
17 | uint how = 0;
18 | while (n % i == 0)
19 | {
20 | how++;
21 | n /= i;
22 | }
23 |
24 | for (int j = 0; j < how; j++)
25 | {
26 | Console.Write("{0} ", i);
27 | }
28 | }
29 |
30 | Console.WriteLine();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PrimeFactorization/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PrimeNimbersEratosthenes/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PrimeNimbersEratosthenes/PrimeNimbersEratosthenesSieve.cs:
--------------------------------------------------------------------------------
1 | namespace PrimeNimbersEratosthenes
2 | {
3 | using System;
4 |
5 | public class PrimeNimbersEratosthenesSieve
6 | {
7 | private const uint N = 200;
8 | private static bool[] sieve = new bool[N + 1];
9 |
10 | internal static void Main()
11 | {
12 | FindPrimeNumbersToN(N);
13 | Console.WriteLine();
14 | }
15 |
16 | private static void FindPrimeNumbersToN(uint n)
17 | {
18 | uint i = 2;
19 | while (i <= n)
20 | {
21 | if (!sieve[i])
22 | {
23 | Console.Write("{0} ", i);
24 | uint j = i * i;
25 | while (j <= n)
26 | {
27 | sieve[j] = true;
28 | j += i;
29 | }
30 | }
31 |
32 | i++;
33 | }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PrimeNimbersEratosthenes/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PrimeNumbersFinder/PrimeNumbersFinder.cs:
--------------------------------------------------------------------------------
1 | namespace PrimeNumbersFinder
2 | {
3 | using System;
4 |
5 | public class PrimeNumbersFinder
6 | {
7 | private const uint N = 23;
8 |
9 | internal static void Main()
10 | {
11 | if (IsPrime(N))
12 | {
13 | Console.WriteLine("Числото {0} е просто.", N);
14 | }
15 | else
16 | {
17 | Console.WriteLine("Числото {0} е съставно.", N);
18 | }
19 | }
20 |
21 | private static bool IsPrime(uint number)
22 | {
23 | if (number == 2)
24 | {
25 | return true;
26 | }
27 |
28 | uint divider = 2;
29 | while (divider <= Math.Sqrt(number))
30 | {
31 | if (number % divider == 0)
32 | {
33 | return false;
34 | }
35 |
36 | divider++;
37 | }
38 |
39 | return true;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/PrimeNumbersFinder/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/ProductOfArrayElements/ProductOfArrayElements.cs:
--------------------------------------------------------------------------------
1 | namespace ProductOfArrayElements
2 | {
3 | using System;
4 |
5 | public class ProductOfArrayElements
6 | {
7 | internal static void Main()
8 | {
9 | int[] elements = new int[] { -5, 8, 22, 25, -158, 73 };
10 | long product = GetProduct(elements);
11 |
12 | Console.WriteLine(
13 | "Произведението на масива с елементи {0} е {1}",
14 | string.Join(", ", elements),
15 | product);
16 | }
17 |
18 | private static long GetProduct(int[] elements)
19 | {
20 | long product = 1L;
21 | for (int i = 0; i < elements.Length; i++)
22 | {
23 | product *= elements[i];
24 | }
25 |
26 | return product;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/ProductOfArrayElements/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/RecursiveFactorialCalculator/RecursiveFactorialCalculator.cs:
--------------------------------------------------------------------------------
1 | namespace RecursiveFactorialCalculator
2 | {
3 | using System;
4 |
5 | public class RecursiveFactorialCalculator
6 | {
7 | private const uint N = 6;
8 |
9 | internal static void Main()
10 | {
11 | Console.WriteLine("{0}! = {1}", N, GetFactorial(N));
12 | }
13 |
14 | private static ulong GetFactorial(uint i)
15 | {
16 | if (i < 2)
17 | {
18 | return i;
19 | }
20 |
21 | return i * GetFactorial(i - 1);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/RecursiveFactorialCalculator/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/RecursiveFibonacci/RecursiveFibonacci.cs:
--------------------------------------------------------------------------------
1 | namespace RecursiveFibonacci
2 | {
3 | using System;
4 |
5 | public class RecursiveFibonacci
6 | {
7 | private const uint N = 7;
8 |
9 | internal static void Main()
10 | {
11 | Console.WriteLine("Fibonacci({0}) = {1}", N, GetFibonacciNumber(N));
12 | }
13 |
14 | private static ulong GetFibonacciNumber(uint number)
15 | {
16 | if (number < 2)
17 | {
18 | return number;
19 | }
20 |
21 | return GetFibonacciNumber(number - 1) + GetFibonacciNumber(number - 2);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/RecursiveFibonacci/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/RecursiveGreatestCommonDivisor/RecursiveGreatestCommonDivisor.cs:
--------------------------------------------------------------------------------
1 | namespace RecursiveGreatestCommonDivisor
2 | {
3 | using System;
4 |
5 | public class RecursiveGreatestCommonDivisor
6 | {
7 | private const uint A = 24;
8 | private const uint B = 108;
9 |
10 | internal static void Main()
11 | {
12 | Console.WriteLine(
13 | "Най-големият общ делител на {0} и {1} е {2}",
14 | A,
15 | B,
16 | GetGreatestCommonDivisor(A, B));
17 | }
18 |
19 | private static uint GetGreatestCommonDivisor(uint a, uint b)
20 | {
21 | return (b == 0) ? a : GetGreatestCommonDivisor(b, a % b);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/RecursiveGreatestCommonDivisor/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/RecursivePrint/RecursivePrint.cs:
--------------------------------------------------------------------------------
1 | namespace RecursivePrint
2 | {
3 | using System;
4 |
5 | public class RecursivePrint
6 | {
7 | private const uint N = 7892;
8 |
9 | internal static void Main()
10 | {
11 | PrintN(N);
12 | Console.WriteLine();
13 | }
14 |
15 | private static void PrintN(uint n)
16 | {
17 | if (n >= 10)
18 | {
19 | PrintN(n / 10);
20 | }
21 |
22 | Console.Write(n % 10);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/RecursivePrint/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/RomanNumerals/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SequencePrint1/SequencePrint1.cs:
--------------------------------------------------------------------------------
1 | namespace SequencePrint1
2 | {
3 | using System;
4 |
5 | public class SequencePrint1
6 | {
7 | private const uint N = 5;
8 |
9 | internal static void Main()
10 | {
11 | PrintSequence(1, 10);
12 | Console.WriteLine();
13 | }
14 |
15 | private static void PrintSequence(uint k, ulong result)
16 | {
17 | Console.Write("{0} ", result);
18 | if (k < N)
19 | {
20 | PrintSequence(k + 1, result * 10);
21 | }
22 |
23 | Console.Write("{0} ", result);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SequencePrint1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SequencePrint2/SequencePrint2.cs:
--------------------------------------------------------------------------------
1 | namespace SequencePrint2
2 | {
3 | using System;
4 |
5 | public class SequencePrint2
6 | {
7 | private const uint N = 5;
8 |
9 | private static uint k = 0;
10 |
11 | internal static void Main()
12 | {
13 | PrintSequence(10);
14 | Console.WriteLine();
15 | }
16 |
17 | private static void PrintSequence(ulong result)
18 | {
19 | k++;
20 | Console.Write("{0} ", result);
21 | if (k < N)
22 | {
23 | PrintSequence(result * 10);
24 | }
25 |
26 | Console.Write("{0} ", result);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SequencePrint2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SequencePrint3/SequencePrint3.cs:
--------------------------------------------------------------------------------
1 | namespace SequencePrint3
2 | {
3 | using System;
4 |
5 | public class SequencePrint3
6 | {
7 | private const uint N = 5;
8 |
9 | private static uint k = 0;
10 | private static ulong result = 1;
11 |
12 | internal static void Main()
13 | {
14 | PrintSequence();
15 | Console.WriteLine();
16 | }
17 |
18 | private static void PrintSequence()
19 | {
20 | k++;
21 | result *= 10;
22 |
23 | Console.Write("{0} ", result);
24 | if (k < N)
25 | {
26 | PrintSequence();
27 | }
28 |
29 | Console.Write("{0} ", result);
30 | result /= 10;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SequencePrint3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SumOfArrayElements/SumOfArrayElements.cs:
--------------------------------------------------------------------------------
1 | namespace SumOfArrayElements
2 | {
3 | using System;
4 |
5 | public class SumOfArrayElements
6 | {
7 | internal static void Main()
8 | {
9 | int[] elements = new int[] { -5, 8, 22, 251, -158, 73 };
10 | long sum = GetSum(elements);
11 | Console.WriteLine(
12 | "Сумата на масива с елементи {0} е {1}",
13 | string.Join(", ", elements),
14 | sum);
15 | }
16 |
17 | private static long GetSum(int[] elements)
18 | {
19 | long sum = 0L;
20 | for (int i = 0; i < elements.Length; i++)
21 | {
22 | sum += elements[i];
23 | }
24 |
25 | return sum;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SumOfArrayElements/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SumOfFirstNNaturalNumbers/SumOfFirstNNaturalNumbers.cs:
--------------------------------------------------------------------------------
1 | namespace SumOfFirstNNaturalNumbers
2 | {
3 | using System;
4 |
5 | public class SumOfFirstNNaturalNumbers
6 | {
7 | internal static void Main()
8 | {
9 | Console.Write("Въведете N: ");
10 | uint n = uint.Parse(Console.ReadLine());
11 | ulong sum = GetSum(n);
12 | Console.WriteLine("Сумата на първите {0} естествени числа е {1}", n, sum);
13 | }
14 |
15 | private static ulong GetSum(uint n)
16 | {
17 | ulong sum = 0UL;
18 | for (uint i = 1; i <= n; i++)
19 | {
20 | sum += i;
21 | }
22 |
23 | return sum;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SumOfFirstNNaturalNumbers/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SumOfMatrices/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/SumZero/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 01 - Introduction To Algorithms/IntroductionToAlgorithms/VariationsGenerator/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Pure CSharp Implementations/BinaryTree/TreeNode.cs:
--------------------------------------------------------------------------------
1 | namespace BinaryTree
2 | {
3 | public class TreeNode
4 | {
5 | public TreeNode(TKey key, TValue value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | this.Parent = null;
10 | this.LeftChild = null;
11 | this.RightChild = null;
12 | }
13 |
14 | public TKey Key { get; set; }
15 |
16 | public TValue Value { get; set; }
17 |
18 | public TreeNode Parent { get; set; }
19 |
20 | public TreeNode LeftChild { get; set; }
21 |
22 | public TreeNode RightChild { get; set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Pure CSharp Implementations/BinaryTree/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Pure CSharp Implementations/HashTable/HashTableExample.cs:
--------------------------------------------------------------------------------
1 | namespace HashTable
2 | {
3 | using System;
4 |
5 | public class HashTableExample
6 | {
7 | internal static void Main()
8 | {
9 | HashTable hashTable = new HashTable();
10 |
11 | hashTable.Add(1234, 100); // в слот 179
12 | hashTable.Add(1774, 120); // в слот 86
13 | hashTable.Add(86, 180); // в слот 86 -> колизия
14 |
15 | Console.WriteLine("Отпечатва данните на елемента с ключ 86: {0}", hashTable.Find(86));
16 | Console.WriteLine("Отпечатва данните на елемента с ключ 1234: {0}", hashTable.Find(1234));
17 | Console.WriteLine("Отпечатва данните на елемента с ключ 1774: {0}", hashTable.Find(1774));
18 |
19 | try
20 | {
21 | Console.WriteLine("Отпечатва данните на елемента с ключ 1773: {0}", hashTable.Find(1773));
22 | }
23 | catch (InvalidOperationException ioe)
24 | {
25 | Console.WriteLine(ioe.Message);
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Pure CSharp Implementations/HashTable/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Pure CSharp Implementations/LinkedList/LinkedListNode.cs:
--------------------------------------------------------------------------------
1 | namespace LinkedList
2 | {
3 | public class LinkedListNode
4 | {
5 | public LinkedListNode(T value)
6 | {
7 | this.Value = value;
8 | }
9 |
10 | public T Value { get; set; }
11 |
12 | public LinkedListNode Next { get; set; }
13 |
14 | public LinkedListNode Previous { get; set; }
15 |
16 | public LinkedList List { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Pure CSharp Implementations/LinkedList/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Pure CSharp Implementations/Queue/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Pure CSharp Implementations/Stack/StackExample.cs:
--------------------------------------------------------------------------------
1 | namespace Stack
2 | {
3 | using System;
4 |
5 | public class StackExample
6 | {
7 | internal static void Main()
8 | {
9 | Stack stack = new Stack();
10 |
11 | // Четат се цели числа от клавиатурата до прочитане на 0 и се включват в стека
12 | int number = int.Parse(Console.ReadLine());
13 |
14 | while (number != 0)
15 | {
16 | stack.Push(number);
17 | number = int.Parse(Console.ReadLine());
18 | }
19 |
20 | // Изключват се последователно всички елементи от стека и се печатат. Това ще
21 | // доведе до отпечатване на първоначално въведената последователност в обратен ред
22 | while (!stack.IsEmpty())
23 | {
24 | int numberOnTop = stack.Pop();
25 | Console.WriteLine(numberOnTop);
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Pure CSharp Implementations/Stack/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/BinaryTree/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/HashSet/SingleWord.cs:
--------------------------------------------------------------------------------
1 | namespace HashSet
2 | {
3 | public struct SingleWord
4 | {
5 | // Ключ - символен низ
6 | public string Word { get; set; }
7 |
8 | // Честота на срещане на думата
9 | public ulong Frequency { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/HashSet/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/HashTable/LinkedList.cs:
--------------------------------------------------------------------------------
1 | namespace HashTable
2 | {
3 | public class LinkedList
4 | {
5 | public long Key { get; set; }
6 |
7 | public int Data { get; set; }
8 |
9 | public LinkedList Next { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/HashTable/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/LinkedList/LinkedList.cs:
--------------------------------------------------------------------------------
1 | namespace LinkedList
2 | {
3 | public class LinkedList
4 | {
5 | public LinkedList()
6 | {
7 | }
8 |
9 | public LinkedList(K key, T data)
10 | {
11 | this.Key = key;
12 | this.Data = data;
13 | }
14 |
15 | public K Key { get; set; }
16 |
17 | public T Data { get; set; }
18 |
19 | public LinkedList Next { get; set; }
20 | }
21 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/LinkedList/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/Queue/Program.cs:
--------------------------------------------------------------------------------
1 | namespace Queue
2 | {
3 | using System;
4 |
5 | public class Program
6 | {
7 | private const int Max = 10;
8 |
9 | internal static void Main()
10 | {
11 | Queue queue = new Queue(Max);
12 |
13 | for (int i = 0; i < 2 * Max; i++)
14 | {
15 | queue.Put(i);
16 | int itemInFront = queue.Get();
17 | Console.Write("{0} ", itemInFront);
18 | }
19 |
20 | //// Това ще причини препълване при последното включване
21 | ////for (var i = 0; i < Max + 1; i++)
22 | ////{
23 | //// queue.Put(i);
24 | ////}
25 |
26 | //// Това ще причини грешка при последното изключване, тъй като опашката е празна
27 | ////for (var i = 0; i < Max; i++)
28 | ////{
29 | //// queue.Put(i);
30 | ////}
31 |
32 | ////for (int i = 0; i < Max + 1; i++)
33 | ////{
34 | //// queue.Get();
35 | ////}
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/Queue/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/Stack1/Program.cs:
--------------------------------------------------------------------------------
1 | namespace Stack1
2 | {
3 | public class Program
4 | {
5 | internal static void Main()
6 | {
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/Stack1/Stack.cs:
--------------------------------------------------------------------------------
1 | namespace Stack1
2 | {
3 | public class Stack
4 | {
5 | private readonly T[] stack;
6 | private int top;
7 |
8 | public Stack()
9 | {
10 | this.stack = new T[10];
11 | this.top = 0;
12 | }
13 |
14 | public void Push(T item)
15 | {
16 | this.stack[this.top] = item;
17 | this.top++;
18 | }
19 |
20 | public T Pop()
21 | {
22 | this.top--;
23 | T item = this.stack[this.top];
24 | return item;
25 | }
26 |
27 | public bool IsEmpty()
28 | {
29 | if (this.top == 0)
30 | {
31 | return true;
32 | }
33 | else
34 | {
35 | return false;
36 | }
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/Stack1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/Stack2/Program.cs:
--------------------------------------------------------------------------------
1 | namespace Stack2
2 | {
3 | using System;
4 |
5 | public class Program
6 | {
7 | internal static void Main()
8 | {
9 | Stack stack = new Stack();
10 |
11 | // Четат се цели числа от клавиатурата до прочитане на 0 и се включват в стека
12 | int number = int.Parse(Console.ReadLine());
13 |
14 | while (number != 0)
15 | {
16 | stack.Push(number);
17 | number = int.Parse(Console.ReadLine());
18 | }
19 |
20 | // Изключват се последователно всички елементи от стека и се печатат. Това ще
21 | // доведе до отпечатване на първоначално въведената последователност в обратен ред
22 | while (!stack.IsEmpty())
23 | {
24 | int numberOnTop = stack.Pop();
25 | Console.WriteLine(numberOnTop);
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/Chapter 02 - Introduction To Data Structures/Strictly following book implementations/Stack2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/BitwiseSort.Tests/BitwiseSortTests.cs:
--------------------------------------------------------------------------------
1 | namespace BitwiseSort.Tests
2 | {
3 | using System;
4 |
5 | using NUnit.Framework;
6 |
7 | [TestFixture]
8 | public class BitwiseSortTests
9 | {
10 | [Test]
11 | [ExpectedException(typeof(ArgumentNullException))]
12 | public void BitwiseSortNullInputShouldThrowException()
13 | {
14 | BitwiseSortAlgorithm.BitwiseSort(null);
15 | }
16 |
17 | [Test]
18 | public void BitwiseSortRandomInputShouldBeSorted()
19 | {
20 | const int MaxValue = 100;
21 |
22 | NodeElement head = BitwiseSortAlgorithm.Initialize(MaxValue);
23 | head = BitwiseSortAlgorithm.BitwiseSort(head);
24 | CheckSortOrder(head);
25 |
26 | Assert.Pass("Collection is sorted");
27 | }
28 |
29 | private static void CheckSortOrder(NodeElement head)
30 | {
31 | for (; head.Next != null; head = head.Next)
32 | {
33 | if (head.Data.Key > head.Next.Data.Key)
34 | {
35 | Assert.Fail("Collection is not sorted correctly! Wrong Order!");
36 | }
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/BitwiseSort.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/BitwiseSort2.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/BubbleSort.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/BubbleSort2.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/CombSorter.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/CountSorter.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace CountSorter.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/CountSorter.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/CountSorter2.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace CountSorter2.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/CountSorter2.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/HeapSort.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace HeapSort.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/HeapSort.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/InsertionSort.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace InsertionSort.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/InsertionSort.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/InsertionSort2.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace InsertionSort2.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/InsertionSort2.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/InsertionSort3.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace InsertionSort3.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/InsertionSort3.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/PermutationSort.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace PermutationSort.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/PermutationSort.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/RadixSort.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace RadixSort.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/RadixSort.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SelectionSort1.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace SelectionSort1.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SelectionSort1.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SelectionSort2.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace SelectionSort2.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SelectionSort2.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SetSort1.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace SetSort1.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SetSort1.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SetSort2.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace SetSort2.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SetSort2.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/ShakerSort.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace ShakerSort.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/ShakerSort.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/ShellSort.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace ShellSort.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/ShellSort.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/ShellSort2.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | namespace ShellSort2.Tests
2 | {
3 | using NUnit.Framework;
4 |
5 | [TestFixture]
6 | public class UnitTest1
7 | {
8 | [Test]
9 | public void Test1()
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/ShellSort2.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BitwiseSort/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BitwiseSort
2 | {
3 | public class Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BitwiseSort/NodeElement.cs:
--------------------------------------------------------------------------------
1 | namespace BitwiseSort
2 | {
3 | public class NodeElement
4 | {
5 | public NodeElement()
6 | {
7 | this.Data = new Element();
8 | }
9 |
10 | public Element Data { get; set; }
11 |
12 | public NodeElement Next { get; set; }
13 |
14 | public override string ToString()
15 | {
16 | return this.Data.Key.ToString();
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BitwiseSort/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BitwiseSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BitwiseSort2/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BitwiseSort2
2 | {
3 | public class Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BitwiseSort2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BubbleSort/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BubbleSort
2 | {
3 | public class Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BubbleSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BubbleSort2/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BubbleSort2
2 | {
3 | public class Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/BubbleSort2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/CombSort/Element.cs:
--------------------------------------------------------------------------------
1 | namespace CombSort
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/CombSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/CountSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/CountSorter2/Element.cs:
--------------------------------------------------------------------------------
1 | namespace CountSorter2
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/CountSorter2/List.cs:
--------------------------------------------------------------------------------
1 | namespace CountSorter2
2 | {
3 | public class List
4 | {
5 | public Element Data { get; set; }
6 |
7 | public List Next { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/CountSorter2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/HeapSort/Element.cs:
--------------------------------------------------------------------------------
1 | namespace HeapSort
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/HeapSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/InsertionSort/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/InsertionSort/Element.cs:
--------------------------------------------------------------------------------
1 | namespace InsertionSort
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/InsertionSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/InsertionSort2/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/InsertionSort2/Element.cs:
--------------------------------------------------------------------------------
1 | namespace InsertionSort2
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/InsertionSort2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/InsertionSort3/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/InsertionSort3/Element.cs:
--------------------------------------------------------------------------------
1 | namespace InsertionSort3
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/InsertionSort3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/PermutationSort/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/PermutationSort/Element.cs:
--------------------------------------------------------------------------------
1 | namespace PermutationSort
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/PermutationSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/RadixSort/Element.cs:
--------------------------------------------------------------------------------
1 | namespace RadixSort
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/RadixSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/SelectionSort1/Element.cs:
--------------------------------------------------------------------------------
1 | namespace SelectionSort1
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/SelectionSort1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/SelectionSort2/Element.cs:
--------------------------------------------------------------------------------
1 | namespace SelectionSort2
2 | {
3 | public struct Element
4 | {
5 | public int Key { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/SelectionSort2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/SetSort1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/SetSort2/Element.cs:
--------------------------------------------------------------------------------
1 | namespace SetSort2
2 | {
3 | public struct Element
4 | {
5 | public int Key;
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/SetSort2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/ShakerSort/Element.cs:
--------------------------------------------------------------------------------
1 | namespace ShakerSort
2 | {
3 | public struct Element
4 | {
5 | public int Key;
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/ShakerSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/ShellSort/Element.cs:
--------------------------------------------------------------------------------
1 | namespace ShellSort
2 | {
3 | public struct Element
4 | {
5 | public int Key;
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/ShellSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/ShellSort2/Element.cs:
--------------------------------------------------------------------------------
1 | namespace ShellSort2
2 | {
3 | public struct Element
4 | {
5 | public int Key;
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 03 - Sorting Algorithms/SortingAlgorithms/ShellSort2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.Iterative/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BinarySearch.Iterative
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.Iterative/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.Recursive/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BinarySearch.Recursive
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.Recursive/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.UsingBitwiseOperations/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BinarySearch.UsingBitwiseOperations
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.UsingBitwiseOperations/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.UsingBitwiseOperations2/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BinarySearch.UsingBitwiseOperations2
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.UsingBitwiseOperations2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.WithoutCycles/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BinarySearch.WithoutCycles
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/BinarySearch.WithoutCycles/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/FibunacciSearch/Element.cs:
--------------------------------------------------------------------------------
1 | namespace FibunacciSearch
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 |
15 | public override string ToString()
16 | {
17 | return this.Value.ToString();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/FibunacciSearch/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/InterpolSearch/Element.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSearch
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 |
15 | public override string ToString()
16 | {
17 | return this.Value.ToString();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/InterpolSearch/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/JumpSearch/Element.cs:
--------------------------------------------------------------------------------
1 | namespace JumpSearch
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/JumpSearch/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/ReorderSearchingAlgorithm/Element.cs:
--------------------------------------------------------------------------------
1 | namespace ReorderSearchingAlgorithm
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 |
15 | public Element Next { get; set; }
16 | }
17 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/ReorderSearchingAlgorithm/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/SequentialSearchAlgorithm/Element.cs:
--------------------------------------------------------------------------------
1 | namespace SequentialSearchAlgorithm
2 | {
3 | public class Element
4 | {
5 | public Element(int key, T value)
6 | {
7 | this.Key = key;
8 | this.Value = value;
9 | }
10 |
11 | public int Key { get; set; }
12 |
13 | public T Value { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Chapter 04 - Searching Algorithms/SequentialSearchAlgorithm/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/A-Center/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/AllSimplePaths/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/ArticPoints/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/BreadthFirstSearch/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/CompanyControl/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/CyclicGraphCheck/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/DepthFirstSearch/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/DijkstraAlgorithm/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/EulerCycle/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/FloydAlgorithm/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/FordFulkersonAlgorithm/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/FullTopologicalSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/FundamentalCycles/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/GraphComponents/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/KruskalAlgorithm/Arc.cs:
--------------------------------------------------------------------------------
1 | namespace KruskalAlgorithm
2 | {
3 | using System;
4 |
5 | public struct Arc : IComparable
6 | {
7 | public int Vertex1 { get; set; }
8 |
9 | public int Vertex2 { get; set; }
10 |
11 | public int Weight { get; set; }
12 |
13 | public int CompareTo(Arc other)
14 | {
15 | return this.Weight.CompareTo(other.Weight);
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/KruskalAlgorithm/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/LongestPath/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/MaximalIndependentSets/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/MinimalDominatingSets/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/MinimalHamiltonianCycle/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/P-Center/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/PrimAlgorithm/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/ShortestPath/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/StronglyConnectedComponents/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/TopologicalSort/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/TransitiveOrientation/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/GraphTheory/VerticesBase/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 05 - Graph Theory/Translations.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Programming-Algorithms-Book/CSharp-Translation-Sources/9dc92a8d033af882584065a88d9f47475bde8db5/Chapter 05 - Graph Theory/Translations.xlsx
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/BooleanSatisfiability/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/Examples/Program.cs:
--------------------------------------------------------------------------------
1 | namespace Examples
2 | {
3 | using System;
4 |
5 | public class Program
6 | {
7 | internal static void Main(string[] args)
8 | {
9 | for (int x = 3;;)
10 | {
11 | for (int a = 1; a <= x; a++)
12 | {
13 | for (int b = 1; b <= x; b++)
14 | {
15 | for (int c = 1; c <= x; c++)
16 | {
17 | for (int i = 3; i <= x; i++)
18 | {
19 | if (Math.Pow(a, i) + Math.Pow(b, i) == Math.Pow(c, i))
20 | {
21 | Console.WriteLine("Found");
22 | return;
23 | }
24 | }
25 | }
26 | }
27 | }
28 |
29 | x++;
30 | }
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/Examples/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/GraphColoring/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/KinightsTour/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/KnapsackProblem/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/LetterTranslation/TranslationType.cs:
--------------------------------------------------------------------------------
1 | namespace LetterTranslation
2 | {
3 | public struct TranslationType
4 | {
5 | public TranslationType(string firstString, string secondString)
6 | : this()
7 | {
8 | this.FirstString = firstString;
9 | this.SecondString = secondString;
10 | }
11 |
12 | public string FirstString { get; set; }
13 |
14 | public string SecondString { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/LetterTranslation/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/LongestPathProblem/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/SchoolSchedule/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/SevenQueensProblem/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 06 - NP-Complete/TicTacToe/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/BinaryMerger/Element.cs:
--------------------------------------------------------------------------------
1 | namespace BinaryMerge
2 | {
3 | public struct Element
4 | {
5 | public Element(int key) : this()
6 | {
7 | this.Key = key;
8 | }
9 |
10 | public int Key { get; set; }
11 |
12 | /* .............
13 | Някакви данни
14 | ............. */
15 | }
16 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/BinaryMerger/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/FastPow/FastPow.cs:
--------------------------------------------------------------------------------
1 | namespace FastPow
2 | {
3 | using System;
4 |
5 | public class FastPow
6 | {
7 | private const double BaseNumber = 3.14;
8 | private const int Power = 11;
9 |
10 | internal static void Main()
11 | {
12 | Console.WriteLine("{0}^{1} = {2}", BaseNumber, Power, FastPower(BaseNumber, Power));
13 | }
14 |
15 | private static double FastPower(double x, int n)
16 | {
17 | if (n == 0)
18 | {
19 | return 1;
20 | }
21 | else
22 | {
23 | if ((n & 1) == 1)
24 | {
25 | return x * FastPower(x, n - 1);
26 | }
27 | else
28 | {
29 | return FastPower(x * x, n / 2);
30 | }
31 | }
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/FastPow/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/FindKthBiggestElement/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/FindKthMiddleElement/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/FindKthMiddleElement2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant10/Majorant10.cs:
--------------------------------------------------------------------------------
1 | namespace Majorant10
2 | {
3 | using System;
4 |
5 | public class Majorant10
6 | {
7 | internal static void Main()
8 | {
9 | char majority;
10 | char[] array = { 'A', 'C', 'A', 'C', 'C', 'B', 'B', 'C', 'C', 'C', 'B', 'C', 'A', };
11 | FindMajority(array, out majority);
12 | Console.WriteLine("Мажорант: {0}", majority);
13 | }
14 |
15 | private static void FindMajority(T[] array, out T majority)
16 | {
17 | int size = array.Length;
18 | do
19 | {
20 | int currentCounter = 0;
21 | for (int i = 1; i < size; i += 2)
22 | {
23 | if (array[i - 1].Equals(array[i]))
24 | {
25 | array[currentCounter++] = array[i];
26 | }
27 | }
28 |
29 | if ((currentCounter & 1) == 0)
30 | {
31 | array[currentCounter++] = array[size - 1];
32 | }
33 |
34 | size = currentCounter;
35 | }
36 | while (size > 1);
37 | majority = array[0];
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant10/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant11/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant12FindWithStack/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant13/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant2/Majorant2.cs:
--------------------------------------------------------------------------------
1 | namespace Majorant2
2 | {
3 | using System;
4 |
5 | public class Majorant2
6 | {
7 | internal static void Main()
8 | {
9 | char[] array = { 'A', 'C', 'B', 'C', 'B', 'B', 'B', 'C', 'B', 'C', 'B', 'B', 'A' };
10 | char majority = default(char);
11 | FindMajority(array, out majority);
12 | if (majority != default(char))
13 | {
14 | Console.WriteLine("Мажорант: {0}", majority);
15 | }
16 | else
17 | {
18 | Console.WriteLine("Няма мажорант.");
19 | }
20 | }
21 |
22 | private static void FindMajority(T[] array, out T majority)
23 | {
24 | majority = default(T);
25 | int size2 = array.Length / 2;
26 | for (int i = 0; i < size2; i++)
27 | {
28 | int counter = 0;
29 | for (int j = i; j < array.Length; j++)
30 | {
31 | if (array[i].Equals(array[j]))
32 | {
33 | counter++;
34 | }
35 | }
36 |
37 | if (counter > size2)
38 | {
39 | majority = array[i];
40 | }
41 | }
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant4/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant5/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant6/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant7/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant8/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant9/Majorant9.cs:
--------------------------------------------------------------------------------
1 | namespace Majorant9
2 | {
3 | using System;
4 |
5 | public class Majorant9
6 | {
7 | internal static void Main()
8 | {
9 | char majority;
10 | char[] array = { 'A', 'A', 'A', 'C', 'C', 'C', 'B', 'C', 'B', 'C', 'C', 'C', 'A', };
11 | FindMajority(array, out majority);
12 | Console.WriteLine("Мажорант: {0}", majority);
13 | }
14 |
15 | private static void FindMajority(T[] array, out T majority)
16 | {
17 | int size = array.Length;
18 | majority = default(T);
19 | do
20 | {
21 | int currentCounter = 0;
22 | for (int i = 1; i < size; i += 2)
23 | {
24 | if (array[i - 1].Equals(array[i]))
25 | {
26 | array[currentCounter++] = array[i];
27 | }
28 | }
29 |
30 | if (size % 2 == 1)
31 | {
32 | majority = array[size - 1];
33 | }
34 |
35 | size = currentCounter;
36 | }
37 | while (size > 0);
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Majorant9/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergeSortIterative/Node.cs:
--------------------------------------------------------------------------------
1 | namespace MergeSortIterative
2 | {
3 | public class Node
4 | {
5 | static Node()
6 | {
7 | Z = new Node { Value = int.MaxValue };
8 | Z.Next = Z;
9 | }
10 |
11 | public static Node Z { get; private set; }
12 |
13 | public int Value { get; set; }
14 |
15 | public Node Next { get; set; }
16 | }
17 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergeSortIterative/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergeSortLinkedList/Node.cs:
--------------------------------------------------------------------------------
1 | namespace MergeSortLinkedList
2 | {
3 | public class Node
4 | {
5 | public int Value { get; set; }
6 |
7 | public Node Next { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergeSortLinkedList/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergeSorter/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergesortLinkedListDoubleStep/Node.cs:
--------------------------------------------------------------------------------
1 | namespace MergesortLinkedListDoubleStep
2 | {
3 | public class Node
4 | {
5 | static Node()
6 | {
7 | Z = new Node { Value = int.MaxValue };
8 | Z.Next = Z;
9 | }
10 |
11 | public static Node Z { get; private set; }
12 |
13 | public int Value { get; set; }
14 |
15 | public Node Next { get; set; }
16 | }
17 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergesortLinkedListDoubleStep/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergingSortedArrays/CList.cs:
--------------------------------------------------------------------------------
1 | namespace MergingSortedArrays
2 | {
3 | public class CList
4 | {
5 | public int Point { get; set; }
6 |
7 | public Element[] Data { get; set; }
8 |
9 | public CList Next { get; set; }
10 |
11 | public int Length { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergingSortedArrays/Element.cs:
--------------------------------------------------------------------------------
1 | namespace MergingSortedArrays
2 | {
3 | public struct Element
4 | {
5 | public Element(int key)
6 | : this()
7 | {
8 | this.Key = key;
9 | }
10 |
11 | public int Key { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MergingSortedArrays/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/MinAndMaxElement/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Shift1/Element.cs:
--------------------------------------------------------------------------------
1 | namespace Shift1
2 | {
3 | public struct Element
4 | {
5 | public int Data { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Shift1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Shift2/Element.cs:
--------------------------------------------------------------------------------
1 | namespace Shift2
2 | {
3 | public struct Element
4 | {
5 | public int Data { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Shift2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Shift3/Element.cs:
--------------------------------------------------------------------------------
1 | namespace Shift3
2 | {
3 | public struct Element
4 | {
5 | public int Data { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Shift3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/SolveHanoyTowers/SolveHanoyTowers.cs:
--------------------------------------------------------------------------------
1 | namespace SolveHanoyTowers
2 | {
3 | using System;
4 |
5 | public class SolveHanoyTowers
6 | {
7 | internal static void Main()
8 | {
9 | int numberOfDisks = 5;
10 | Console.WriteLine("Брой дискове: {0}", numberOfDisks);
11 | SolveHanoy('A', 'C', 'B', numberOfDisks);
12 | }
13 |
14 | private static void MoveDisk(int n, char a, char b)
15 | {
16 | Console.WriteLine("Преместете диск {0} от {1} на {2}", n, a, b);
17 | }
18 |
19 | private static void SolveHanoy(char a, char c, char b, int n)
20 | {
21 | if (n == 1)
22 | {
23 | MoveDisk(1, a, c);
24 | }
25 | else
26 | {
27 | SolveHanoy(a, b, c, n - 1);
28 | MoveDisk(n, a, c);
29 | SolveHanoy(b, c, a, n - 1);
30 | }
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/SolveHanoyTowers/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Tournament3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/TournamentForAllNums/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/TournamentPowerOf2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 07 - Divide And Conquer/Translations.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Programming-Algorithms-Book/CSharp-Translation-Sources/9dc92a8d033af882584065a88d9f47475bde8db5/Chapter 07 - Divide And Conquer/Translations.xlsx
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Alanbob/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Alanbob2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Binom/binom.cs:
--------------------------------------------------------------------------------
1 | namespace Binom
2 | {
3 | using System;
4 |
5 | public class Binom
6 | {
7 | internal static void Main()
8 | {
9 | Console.WriteLine(CalculateBinom(7, 3));
10 | }
11 |
12 | private static int CalculateBinom(int n, int k)
13 | {
14 | if (k > n)
15 | {
16 | return 0;
17 | }
18 | else if (k == 0 || k == n)
19 | {
20 | return 1;
21 | }
22 | else
23 | {
24 | return CalculateBinom(n - 1, k - 1) + CalculateBinom(n - 1, k);
25 | }
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Binom/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Binom2/binom2.cs:
--------------------------------------------------------------------------------
1 | namespace Binom2
2 | {
3 | using System;
4 |
5 | public class Binom2
6 | {
7 | private const int Max = 200;
8 |
9 | /* Динамично оптимиране */
10 | private static readonly int[] Array = new int[Max];
11 |
12 | internal static void Main()
13 | {
14 | Console.WriteLine(CalculateBinomDynamic(7, 3));
15 | }
16 |
17 | private static int CalculateBinomDynamic(int n, int k)
18 | {
19 | int j;
20 | for (int i = 0; i <= n; i++)
21 | {
22 | Array[i] = 1;
23 | if (i > 1)
24 | {
25 | if (k < i - 1)
26 | {
27 | j = k;
28 | }
29 | else
30 | {
31 | j = i - 1;
32 | }
33 |
34 | for (; j >= 1; j--)
35 | {
36 | Array[j] += Array[j - 1];
37 | }
38 | }
39 | }
40 |
41 | return Array[k];
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Binom2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Board/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/BreakNum/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Catalan/Position.cs:
--------------------------------------------------------------------------------
1 | namespace Catalan
2 | {
3 | public struct Position
4 | {
5 | public int X { get; set; }
6 |
7 | public int Y { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Catalan/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Cfl/NonTerminalProduction.cs:
--------------------------------------------------------------------------------
1 | namespace Cfl
2 | {
3 | public struct NonTerminalProduction /* Продукции, отиващи в нетерминали: S->AB */
4 | {
5 | public char S { get; set; }
6 |
7 | public char A { get; set; }
8 |
9 | public char B { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Cfl/Production.cs:
--------------------------------------------------------------------------------
1 | namespace Cfl
2 | {
3 | public struct Production /* Продукции, отиващи в терминали: S->a */
4 | {
5 | public char S { get; set; }
6 |
7 | public char A { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Cfl/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/CoinMin/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/CoinMin2/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/CoinMin2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Coins/Element.cs:
--------------------------------------------------------------------------------
1 | namespace Coins
2 | {
3 | public struct Element
4 | {
5 | public int Number { get; set; }
6 |
7 | public int Last { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Coins/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/ConferenceRoom/BeginEnd.cs:
--------------------------------------------------------------------------------
1 | namespace ConferenceRoom
2 | {
3 | public struct BeginEnd
4 | {
5 | public int Begin { get; set; }
6 |
7 | public int End { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/ConferenceRoom/BlueRed.cs:
--------------------------------------------------------------------------------
1 | namespace ConferenceRoom
2 | {
3 | public struct BlueRed
4 | {
5 | public int BlueCount { get; set; }
6 |
7 | public int RedCount { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/ConferenceRoom/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Cuts/Element.cs:
--------------------------------------------------------------------------------
1 | namespace Cuts
2 | {
3 | public struct Element
4 | {
5 | public int Value { get; set; }
6 |
7 | public int Action { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Cuts/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Domino/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Fibmatr/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Fibmemo/fibmemo.cs:
--------------------------------------------------------------------------------
1 | namespace Fibmemo
2 | {
3 | using System;
4 |
5 | public class Fibmemo
6 | {
7 | private const int Max = 256;
8 | private const int N = 10;
9 |
10 | private static readonly int[] Memo = new int[Max + 1];
11 |
12 | internal static void Main()
13 | {
14 | Console.WriteLine("{0}-тото число на Фибоначи е: {1}", N, FibMemo(N));
15 | }
16 |
17 | private static int FibMemo(int n)
18 | {
19 | if (n < 2)
20 | {
21 | Memo[n] = n;
22 | }
23 | else if (0 == Memo[n])
24 | {
25 | Memo[n] = FibMemo(n - 1) + FibMemo(n - 2);
26 | }
27 |
28 | return Memo[n];
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Fibmemo/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Fibmemo2/fibmemo2.cs:
--------------------------------------------------------------------------------
1 | namespace Fibmemo2
2 | {
3 | using System;
4 |
5 | public class Fibmemo2
6 | {
7 | private const int Max = 250;
8 | private const int N = 10;
9 |
10 | private static readonly int[] Memo = new int[Max + 1];
11 |
12 | internal static void Main()
13 | {
14 | Console.WriteLine("{0}-тото число на Фибоначи е: {1}", N, FibMemo(N - 1));
15 | }
16 |
17 | /* Бърз рекурсивен логаритмичен вариант, запаметяващ вече изчисленото */
18 | private static int FibMemo(int n)
19 | {
20 | if (n < 2)
21 | {
22 | Memo[n] = 1;
23 | }
24 | else if (Memo[n] == 0)
25 | {
26 | if (n % 2 == 1)
27 | {
28 | Memo[n] = FibMemo(n - 1) + FibMemo(n - 2);
29 | }
30 | else
31 | {
32 | Memo[n] = GetSquare(FibMemo(n / 2)) + GetSquare(FibMemo((n / 2) - 1));
33 | }
34 | }
35 |
36 | return Memo[n];
37 | }
38 |
39 | private static int GetSquare(int num)
40 | {
41 | int square = (int)Math.Pow(num, 2);
42 | return square;
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Fibmemo2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Fibrec/fibrec.cs:
--------------------------------------------------------------------------------
1 | namespace Fibrec
2 | {
3 | using System;
4 |
5 | public class Fibrec
6 | {
7 | private const int N = 7;
8 |
9 | internal static void Main()
10 | {
11 | Console.WriteLine("Fib({0}) = {1}", N, Fib(N));
12 | }
13 |
14 | private static int Fib(int n)
15 | {
16 | if (n <= 2)
17 | {
18 | return 1;
19 | }
20 | else
21 | {
22 | return Fib(n - 1) + Fib(n - 2);
23 | }
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Fibrec/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Hedonia/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/JaggedSequence/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Knapsack1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Knapsack2a/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Knapsack2b/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Knapsack3a/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Knapsack3b/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Knapsack3c/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Knapsack4/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Knapsack5/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/LongestCommonSubsequence1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/LongestCommonSubsequence2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/LongestNonDecreasingSubsequence1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/LongestNonDecreasingSubsequence2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/LongestNonDecreasingSubsequence3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/MatrixMultiplication1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/MatrixMultiplication2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/MatrixMultiplication3/Order.cs:
--------------------------------------------------------------------------------
1 | namespace MatrixMultiplication3
2 | {
3 | public class Order
4 | {
5 | public int Left { get; set; }
6 |
7 | public int Right { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/MatrixMultiplication3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/NoTwoZeroes/Program.cs:
--------------------------------------------------------------------------------
1 | namespace NoTwoZeroes
2 | {
3 | using System;
4 |
5 | public class Program
6 | {
7 | private const long NotSolved = -1;
8 | private const int N = 10;
9 | private const int K = 7;
10 |
11 | private static readonly long[] F = new long[N + 1]; /* Целева функция */
12 | private static readonly long[] Pow = new long[N + 1]; /* Степените на k */
13 |
14 | internal static void Main()
15 | {
16 | Init();
17 | F[0] = 1;
18 | F[1] = K;
19 | F[2] = (K * K) - 1;
20 | Console.WriteLine((K - 1) * Solve(N - 1));
21 | }
22 |
23 | private static void Init()
24 | {
25 | Pow[0] = 1;
26 | for (int i = 1; i <= N; i++)
27 | {
28 | Pow[i] = K * Pow[i - 1];
29 | F[i] = NotSolved;
30 | }
31 | }
32 |
33 | private static long Solve(int s)
34 | {
35 | if (F[s] == NotSolved)
36 | {
37 | F[s] = Pow[s - 2];
38 | for (int i = 1; i < s - 1; i++)
39 | {
40 | F[s] += Solve(i - 1) * (K - 1) * Pow[s - i - 2];
41 | }
42 |
43 | F[s] = Pow[s] - F[s];
44 | }
45 |
46 | return F[s];
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/NoTwoZeroes/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/OptimalBinarySearchTree/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/OptimalBitonicSequence/St.cs:
--------------------------------------------------------------------------------
1 | namespace OptimalBitonicSequence
2 | {
3 | public struct St
4 | {
5 | /* Дължина на максималната ненамаляваща подредица, завършваща в i */
6 | public int Length { get; set; }
7 |
8 | /* Индекс на предишния елемент в макс. редица */
9 | public int Back { get; set; }
10 |
11 | /* Сума на елементите на максималната редица */
12 | public long Sum { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/OptimalBitonicSequence/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Partitioning/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/RailwayTickets/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/ResourceDistribution/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/RingExpression/Goal.cs:
--------------------------------------------------------------------------------
1 | namespace RingExpression
2 | {
3 | public struct Goal
4 | {
5 | public long Min { get; set; }
6 |
7 | public long Max { get; set; }
8 |
9 | public int LenMin { get; set; }
10 |
11 | public int LenMax { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/RingExpression/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/SportSeries1/Program.cs:
--------------------------------------------------------------------------------
1 | namespace SportSeries1
2 | {
3 | using System;
4 |
5 | public class Program
6 | {
7 | private const double Probability = 0.5; /* Вероятност A да спечели отделен мач */
8 | private const int N = 5;
9 |
10 | internal static void Main()
11 | {
12 | for (int i = 0; i < N; i++)
13 | {
14 | for (int j = 0; j < N; j++)
15 | {
16 | Console.Write("{0:F6} ", P(i, j));
17 | }
18 |
19 | Console.WriteLine();
20 | }
21 | }
22 |
23 | /* Неефективен рекурсивен вариант */
24 | private static double P(int i, int j)
25 | {
26 | if (0 == j)
27 | {
28 | return 0.0;
29 | }
30 | else if (0 == i)
31 | {
32 | return 1.0;
33 | }
34 | else
35 | {
36 | return (Probability * P(i - 1, j)) + ((1 - Probability) * P(i, j - 1));
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/SportSeries1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/SportSeries2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/SportSeries3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/SportSeries4/Program.cs:
--------------------------------------------------------------------------------
1 | namespace SportSeries4
2 | {
3 | using System;
4 |
5 | public class Program
6 | {
7 | private const double P = 0.5; /* Вероятност A да спечели отделен мач */
8 | private const int N = 5;
9 |
10 | internal static void Main()
11 | {
12 | for (int i = 0; i < N; i++)
13 | {
14 | for (int j = 0; j < N; j++)
15 | {
16 | Console.Write("{0:F6} ", PDynamic3(i, j));
17 | }
18 |
19 | Console.WriteLine();
20 | }
21 | }
22 |
23 | private static double PDynamic3(int i, int j)
24 | {
25 | double[,] pd = new double[(2 * N) - 1, (2 * N) - 1];
26 | for (int s = 1; s <= i + j; s++)
27 | {
28 | pd[0, s] = 1.0;
29 | pd[s, 0] = 0.0;
30 | for (int k = 1; k <= s - 1; k++)
31 | {
32 | pd[k, s - k] = (P * pd[k - 1, s - k]) + ((1 - P) * pd[k, s - k - 1]);
33 | }
34 | }
35 |
36 | return pd[i, j];
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/SportSeries4/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/StringTransform/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/SymbolicMultiplication/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Taxi/Dist.cs:
--------------------------------------------------------------------------------
1 | namespace Taxi
2 | {
3 | public struct Dist
4 | {
5 | public int Last { get; set; } /* Последна измината отсечка */
6 |
7 | public int Value { get; set; } /* Цена на разстоянието */
8 | }
9 | }
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/Taxi/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 08 - Dynamic Programming/TicketQueue/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/ActivityScheduling/ActivityScheduling.cs:
--------------------------------------------------------------------------------
1 | namespace ActivityScheduling
2 | {
3 | using System;
4 |
5 | internal class Program
6 | {
7 | internal static void Main()
8 | {
9 | int[] start = { 3, 5, 7, 9, 13, 15, 17 };
10 | int[] end = { 8, 10, 12, 14, 15, 19, 20 };
11 | Array.Sort(start, end);
12 | Solve(start, end);
13 | }
14 |
15 | private static void Solve(int[] start, int[] end)
16 | {
17 | int i = 1, j = 1;
18 | Console.Write("Избрани лекции: {0} ", 1);
19 |
20 | while (j++ < start.Length)
21 | {
22 | if (start[j - 1] > end[i - 1])
23 | {
24 | Console.Write("{0} ", j);
25 | i = j;
26 | }
27 | }
28 |
29 | Console.WriteLine();
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/ActivityScheduling/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/EgyptianFractions/EgyptianFractions.cs:
--------------------------------------------------------------------------------
1 | namespace EgyptianFractions
2 | {
3 | using System;
4 |
5 | internal class Program
6 | {
7 | internal static void Main()
8 | {
9 | Solve(3, 7);
10 | }
11 |
12 | /* намалява p/q, докато p стане равно на 1 */
13 | private static void Cancel(ref long p, ref long q)
14 | {
15 | if (q % p == 0)
16 | {
17 | q /= p;
18 | p = 1;
19 | }
20 | }
21 |
22 | private static void Solve(long p, long q)
23 | {
24 | Console.Write("{0}/{1} = ", p, q);
25 | Cancel(ref p, ref q);
26 |
27 | while (p > 1)
28 | {
29 | /* намира максималната дроб 1/r, 1/r<=p/q */
30 | long r = (q + p) / p;
31 | Console.Write("{0}/{1} + ", 1, r);
32 |
33 | /* изчислява p/q - 1/r */
34 | p = (p * r) - q;
35 | q = q * r;
36 | Cancel(ref p, ref q);
37 | }
38 |
39 | if (p > 0)
40 | {
41 | Console.Write("{0}/{1}", p, q);
42 | }
43 |
44 | Console.WriteLine();
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/EgyptianFractions/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/FractionalKnapsack/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/GraphColoring/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/GuessingPi/GuessingPi.cs:
--------------------------------------------------------------------------------
1 | namespace GuessingPi
2 | {
3 | using System;
4 |
5 | public class Program
6 | {
7 | internal static void Main()
8 | {
9 | long t = 1000000; /* брой тестове */
10 | int d = 10000; /* диаметър на окръжността */
11 | double r = d / 2;
12 | long k = 0;
13 | var rand = new Random(0);
14 |
15 | for (int i = 0; i < t; i++)
16 | {
17 | int a = (int)(rand.Next(d) - r + 1);
18 | int b = (int)(rand.Next(d) - r + 1);
19 | if (Math.Sqrt((a * a) + (b * b)) <= r)
20 | {
21 | k++;
22 | }
23 | }
24 |
25 | Console.WriteLine("Приближение на pi = {0:F10}", (4.0 * k) / t);
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/GuessingPi/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/HamiltonianCycleGrayCodes/HamiltonianCycleGrayCodes.cs:
--------------------------------------------------------------------------------
1 | namespace HamiltonianCycleGrayCodes
2 | {
3 | using System;
4 | using System.Linq;
5 |
6 | public class Program
7 | {
8 | internal static void Main()
9 | {
10 | /* код на Грей, Хамилтонов цикъл в n-мерен двоичен куб (Хиперкуб) */
11 | const int Dimensions = 3;
12 | int[] a = new int[Dimensions + 1];
13 | Forwgray(a, Dimensions);
14 | }
15 |
16 | private static void Forwgray(int[] a, int k)
17 | {
18 | if (k == 0)
19 | {
20 | Print(a);
21 | return;
22 | }
23 |
24 | a[k] = 0;
25 | Forwgray(a, k - 1);
26 | a[k] = 1;
27 | Backgray(a, k - 1);
28 | }
29 |
30 | private static void Backgray(int[] a, int k)
31 | {
32 | if (k == 0)
33 | {
34 | Print(a);
35 | return;
36 | }
37 |
38 | a[k] = 1;
39 | Forwgray(a, k - 1);
40 | a[k] = 0;
41 | Backgray(a, k - 1);
42 | }
43 |
44 | private static void Print(int[] a)
45 | {
46 | Console.WriteLine(string.Join(" ", a.Skip(1)));
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/HamiltonianCycleGrayCodes/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/KnightsTour/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/PrimeMonteCarlo/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/Scheduling/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/TravellingSalesmanGenetic/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 09 - Heuristic And Probabilistic Algorithms/filelist.txt:
--------------------------------------------------------------------------------
1 | aselect.c => ActivityScheduling
2 | colorg.c => GraphColoring
3 | egypt.c => EgyptianFractions
4 | fracknap.c => FractionalKnapsack
5 | hamgray.c => HamiltonianCycleGrayCodes
6 | knightg.c => KnightsTour
7 | pi.c => GuessingPi
8 | prime_mc.c => PrimeMonteCarlo
9 | schedule.c => Scheduling
10 | tspgenet.c => TravellingSalesmanGenetic
--------------------------------------------------------------------------------
/Chapter 10 - Compression/ArithmeticCoding/Symbol.cs:
--------------------------------------------------------------------------------
1 | namespace ArithmeticCoding
2 | {
3 | public class Symbol
4 | {
5 | public double Low { get; set; }
6 |
7 | public double High { get; set; }
8 |
9 | public char Char { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/Chapter 10 - Compression/ArithmeticCoding/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 10 - Compression/Entropy/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 10 - Compression/Huffman1/Tree.cs:
--------------------------------------------------------------------------------
1 | namespace Huffman1
2 | {
3 | public class Tree
4 | {
5 | public char Char { get; set; } /* Символ (буква) */
6 |
7 | public int Freq { get; set; } /* Честота на срещане на символа */
8 |
9 | public int Weight { get; set; } /* Общо тегло на дървото */
10 |
11 | public Tree Left { get; set; } /* Ляв и десен наследници */
12 |
13 | public Tree Right { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Chapter 10 - Compression/Huffman1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 10 - Compression/Huffman2/Tree.cs:
--------------------------------------------------------------------------------
1 | namespace Huffman2
2 | {
3 | public class Tree
4 | {
5 | public char Char { get; set; } /* Символ (буква) */
6 |
7 | public int Weight { get; set; } /* Общо тегло на дървото */
8 |
9 | public Tree Left { get; set; } /* Ляв и десен наследници */
10 |
11 | public Tree Right { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Chapter 10 - Compression/Huffman2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 10 - Compression/Huffman3/Tree.cs:
--------------------------------------------------------------------------------
1 | namespace Huffman3
2 | {
3 | public class Tree
4 | {
5 | public char Char { get; set; } /* Символ (буква) */
6 |
7 | public int Weight { get; set; } /* Общо тегло на дървото */
8 |
9 | public Tree Left { get; set; } /* Ляв и десен наследници */
10 |
11 | public Tree Right { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Chapter 10 - Compression/Huffman3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 10 - Compression/LempelZiwWelch/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 10 - Compression/LinearPredictionCoding/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chapter 10 - Compression/filelist.txt:
--------------------------------------------------------------------------------
1 | arithmet.c => ArithmeticCoding
2 | entropy.c => Entropy
3 | huffman1.c => Huffman1
4 | huffman2.c => Huffman2
5 | huffman3.c => Huffman3
6 | lpc.c => LinearPredictionCoding
7 | lzw.c => LempelZiwWelch
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | C# Translation of ["Programming =++ Algorithms;"](https://github.com/Programming-Algorithms-Book/C-Original-Sources) book
2 | ===
3 |
4 | ### Authors
5 | * Velko Nikolov (https://github.com/staafl)
6 | * Vladislav Karamfilov (https://github.com/vladislav-karamfilov)
7 | * Vladimir Georgiev (https://github.com/VGGeorgiev)
8 | * Viktor Bahtev (https://github.com/bahtev)
9 | * Teodor Kurtev (https://github.com/Teodor92)
10 |
11 | ##### [Original translation](https://github.com/vladislav-karamfilov/Algorithms-CSharp-Translation)
12 |
--------------------------------------------------------------------------------
/changeDotNet.ps1:
--------------------------------------------------------------------------------
1 | Get-ChildItem . -Recurse -Filter *.*proj |ForEach {
2 | $content = Get-Content $_.FullName
3 | $content |ForEach {
4 | $_.Replace("v4.5", "v4.6")
5 | } |Set-Content $_.FullName
6 | }
--------------------------------------------------------------------------------