repo_name
stringlengths
1
52
repo_creator
stringclasses
6 values
programming_language
stringclasses
4 values
code
stringlengths
0
9.68M
num_lines
int64
1
234k
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class BinaryPrimeConstantSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new Bin...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class BinomialSequenceTests { [Test] public void First4RowsCorrect() { var sequence = new BinomialSequence()....
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences; public class CakeNumbersSequenceTests { [Test] public void First46ElementsCorrect() { var sequence = new CakeNumbersSequence().Sequence.Take(46...
26
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class CatalanSequenceTest { [Test] public void First30ItemsCorrect() { var sequence = new CatalanSequence().Sequ...
23
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences; public class CentralPolygonalNumbersSequenceTests { [Test] public void First53ElementsCorrect() { var sequence = new CentralPolygonalNumbersSeq...
24
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class CubesSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new CubesSequence().S...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class DivisorsCountSequenceTests { [Test] public void First10ElementsCorrect() { // These values are taken from ...
32
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class EuclidNumbersSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new EuclidNum...
21
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class EulerTotientSequenceTests { [Test] public void FirstElementsCorrect() { // Let's be thorough. 500 phi va...
52
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class FactorialSequenceTest { [Test] public void First10ItemsCorrect() { var sequence = new FactorialSequence...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class FermatNumbersSequenceTests { [Test] public void First5ElementsCorrect() { var sequence = new FermatNumb...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class FermatPrimesSequenceTests { [Test] public void All5ElementsCorrect() { var sequence = new FermatPrimesS...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class FibonacciSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new FibonacciSequ...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class GolombsSequenceTests { [Test] public void First50ElementsCorrect() { // Taken from https://oeis.org/A00146...
28
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class KolakoskiSequenceTests { [Test] public void First100ElementsCorrect() { // Taken from https://oeis.org/A00...
37
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class KummerNumbersSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new KummerNum...
21
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences; public class LucasNumbersBeginningAt2SequenceTests { [Test] public void FirstElementsCorrect() { // Initial test of 38 values from http://o...
110
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class MakeChangeSequenceTests { [Test] public void First100ElementsCorrect() { // Values from https://oeis.org/A...
34
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences; [TestFixture] public static class MatchstickTriangleSequenceTests { private static BigInteger[] TestList = { ...
29
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class NaturalSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new NaturalSequence...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class NegativeIntegersSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new Negati...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class NumberOfBooleanFunctionsSequenceTests { [Test] public void First5ElementsCorrect() { var sequence = new...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class NumberOfPrimesByNumberOfDigitsSequenceTests { [Test] public void First5ElementsCorrect() { var sequence...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class NumberOfPrimesByPowersOf10SequenceTests { [Test] public void First5ElementsCorrect() { var sequence = n...
20
C-Sharp
TheAlgorithms
C#
using System.Collections.Generic; using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences; [TestFixture] public class OnesCountingSequenceTest { /// <summary> /// <para> /// Values taken from h...
109
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class PowersOf10SequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new PowersOf10Se...
21
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class PowersOf2SequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new PowersOf2Sequ...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class PrimePiSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new PrimePiSequence...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class PrimesSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new PrimesSequence()...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class PrimorialNumbersSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new Primor...
21
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class RecamansSequenceTests { [Test] public void First50ElementsCorrect() { // Taken from http://oeis.org/A00513...
30
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class SquaresSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new SquaresSequence...
20
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences; [TestFixture] public class TetrahedralSequenceTests { private static readonly BigInteger[] TestList = { ...
31
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences; public class TetranacciNumbersSequenceTests { [Test] public void First35ElementsCorrect() { var sequence = new TetranacciNumbersSequence().Sequ...
24
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class ThreeNPlusOneStepsSequenceTests { [Test] public void First50ElementsCorrect() { var sequence = new ThreeNPlusOneStepsS...
23
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences; public class TribonacciNumbersSequenceTests { [Test] public void First37ElementsCorrect() { var sequence = new TribonacciNumbersSequence().Sequ...
24
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class VanEcksSequenceTests { [Test] public void First50ElementsCorrect() { // Taken from http://oeis.org/A181391...
30
C-Sharp
TheAlgorithms
C#
using System.Linq; using System.Numerics; using Algorithms.Sequences; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Sequences { public class ZeroSequenceTests { [Test] public void First10ElementsCorrect() { var sequence = new ZeroSequence().Sequen...
21
C-Sharp
TheAlgorithms
C#
using Algorithms.Shufflers; using Algorithms.Tests.Helpers; using FluentAssertions; using NUnit.Framework; using System; namespace Algorithms.Tests.Shufflers { public static class FisherYatesShufflerTests { [Test] public static void ArrayShuffled_NewArrayHasSameSize( [Random(10, 100...
88
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class BinaryInsertionSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class BogoSorterTests { [Test] public static void ArraySorted([Random(0, 10, 10, Distinct = true)] int n) { ...
27
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class BubbleSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)] ...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class CocktailSorterTests { [Test] public static void SortsArray( [Random(0, 1000, 100, Distinct = true)] ...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class CombSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)] ...
47
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class CycleSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)] ...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class ExchangeSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)] ...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class HeapSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)] ...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class InsertionSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)] ...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class MedianOfThreeQuickSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = tr...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { /// <summary> /// Class for testing merge sorter algorithm. /// </summary> public static class MergeSorterTests { [Test] p...
32
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class MiddlePointQuickSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class PancakeSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)] ...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class RandomPivotQuickSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class SelectionSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)] ...
29
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class ShellSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 100, Distinct = true)] ...
29
C-Sharp
TheAlgorithms
C#
using System; using System.Linq; using Algorithms.Sorters.Comparison; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Comparison { public static class TimSorterTests { private static readonly IntComparer IntComparer = new(); [Test] public stati...
70
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.External; using Algorithms.Sorters.External.Storages; using Algorithms.Tests.Helpers; using NUnit.Framework; using NUnit.Framework.Internal; namespace Algorithms.Tests.Sorters.External { public static class ExternalMergeSorterTests { [Test] public stati...
68
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Integer; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Integer { public static class BucketSorterTests { [Test] public static void ArraySorted( [Random(0, 1000, 1000, Distinct = true)] ...
28
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Integer; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Integer { public static class CountingSorterTests { [Test] public static void SortsNonEmptyArray( [Random(1, 10000, 100, Distinct = true)] ...
35
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.Integer; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.Integer { public static class RadixSorterTests { [Test] public static void SortsArray( [Random(0, 1000, 100, Distinct = true)] int...
28
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Sorters.String; using Algorithms.Tests.Helpers; using NUnit.Framework; namespace Algorithms.Tests.Sorters.String { /// <summary> /// Class for testing MSD radix sorter algorithm. /// </summary> public static class MsdRadixStringSorterTests { [Test] ...
31
C-Sharp
TheAlgorithms
C#
using Algorithms.Strings; using NUnit.Framework; namespace Algorithms.Tests.Strings { public class BoyerMooreTests { [TestCase("HelloImATestcaseAndIWillPass", "Testcase", 8)] [TestCase("HelloImATestcaseAndImCaseSensitive", "TestCase", -1)] [TestCase("Hello Im a testcase and I work with ...
19
C-Sharp
TheAlgorithms
C#
using System; using Algorithms.Strings; using NUnit.Framework; namespace Algorithms.Tests.Strings { public static class GeneralStringAlgorithmsTests { [Test] [TestCase("Griffith", 'f', 2)] [TestCase("Randomwoooord", 'o', 4)] [TestCase("Control", 'C', 1)] public static...
25
C-Sharp
TheAlgorithms
C#
using Algorithms.Strings; using NUnit.Framework; using System; namespace Algorithms.Tests.Strings { public class HammingDistanceTests { [Test] [TestCase("equal", "equal", 0)] [TestCase("dog", "dig", 1)] [TestCase("12345", "abcde", 5)] public void Calculate_ReturnsCorrect...
26
C-Sharp
TheAlgorithms
C#
using Algorithms.Strings; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Strings { public class JaroSimilarityTests { [Test] [TestCase("equal", "equal", 1)] [TestCase("abc", "123", 0)] [TestCase("FAREMVIEL", "FARMVILLE", 0.88d)] [TestCase("CRAT...
23
C-Sharp
TheAlgorithms
C#
using Algorithms.Strings; using FluentAssertions; using NUnit.Framework; namespace Algorithms.Tests.Strings { public class JaroWinklerDistanceTests { [Test] [TestCase("equal", "equal", 0)] [TestCase("abc", "123", 1)] [TestCase("Winkler", "Welfare", 0.33)] [TestCase("fare...
21
C-Sharp
TheAlgorithms
C#
using Algorithms.Strings; using NUnit.Framework; namespace Algorithms.Tests.Strings { public static class KnuthMorrisPrattSearcherTests { [Test] public static void FindIndexes_ItemsPresent_PassExpected() { // Arrange var searcher = new KnuthMorrisPrattSearcher...
85
C-Sharp
TheAlgorithms
C#
using Algorithms.Strings; using NUnit.Framework; namespace Algorithms.Tests.Strings { public class LevenshteinDistanceTests { [Test] [TestCase("kitten", "sitting", 3)] [TestCase("bob", "bond", 2)] [TestCase("algorithm", "logarithm", 3)] [TestCase("star", "", 4)] ...
22
C-Sharp
TheAlgorithms
C#
using System.Linq; using Algorithms.Strings; using NUnit.Framework; namespace Algorithms.Tests.Strings { public static class NaiveStringSearchTests { [Test] public static void ThreeMatchesFound_PassExpected() { // Arrange var pattern = "ABB"; var cont...
58
C-Sharp
TheAlgorithms
C#
using Algorithms.Strings; using NUnit.Framework; namespace Algorithms.Tests.Strings { public static class PalindromeTests { [Test] [TestCase("Anna")] [TestCase("A Santa at Nasa")] public static void TextIsPalindrome_TrueExpected(string text) { // Arrange ...
35
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using Algorithms.Numeric; using Algorithms.Strings; using NUnit.Framework; namespace Algorithms.Tests.Strings { public class PermutationTests { [TestCase("")] [TestCase("A")] [TestCase("abcd")] ...
76
C-Sharp
TheAlgorithms
C#
using System.Collections.Generic; using Algorithms.Strings; using NUnit.Framework; namespace Algorithms.Tests.Strings { public class RabinKarpTest { [TestCase("HelloImATestcaseAndIWillPass", "Testcase", new[] { 8 })] [TestCase("HelloImATestcaseAndImCaseSensitive", "TestCase", new int[] { })] ...
21
C-Sharp
TheAlgorithms
C#
using Algorithms.Strings; using NUnit.Framework; namespace Algorithms.Tests.Strings { public class ZblockSubstringSearchTest { [TestCase("abc", "abcdef", 1)] [TestCase("xxx", "abxxxcdexxxf", 2)] [TestCase("aa", "waapaaxcdaalaabb", 4)] [TestCase("ABC", "ABAAABCDBBABCDDEBCABC", 3)...
24
C-Sharp
TheAlgorithms
C#
// Original Author: Christian Bender // Class: BitArray // // implements IComparable, ICloneable, IEnumerator, IEnumerable // // This class implements a bit-array and provides some // useful functions/operations to deal with this type of // data structure. You see a overview about the functionality, below. // // // ...
843
C-Sharp
TheAlgorithms
C#
using System.Collections.Generic; using System.Linq; namespace DataStructures { /// <summary> /// Inverted index is the simplest form of document indexing, /// allowing performing boolean queries on text data. /// /// This realization is just simplified for better understanding the process of in...
83
C-Sharp
TheAlgorithms
C#
using System.Collections; using System.Collections.Generic; namespace DataStructures { /// <summary> /// Implementation of SortedList using binary search. /// </summary> /// <typeparam name="T">Generic Type.</typeparam> public class SortedList<T> : IEnumerable<T> { private readonly ...
133
C-Sharp
TheAlgorithms
C#
/* Author: Lorenzo Lotti Name: Timeline (DataStructures.Timeline<TValue>) Type: Data structure (class) Description: A collection of dates/times and values sorted by dates/times easy to query. Usage: this data structure can be used to represent an ordered series of dates or times with which t...
537
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; namespace DataStructures.AATree { /// <summary> /// A simple self-balancing binary search tree. /// </summary> /// <remarks> /// AA Trees are a form of self-balancing binary search tree named after their inventor /// Arne Anderson. ...
394
C-Sharp
TheAlgorithms
C#
namespace DataStructures.AATree { /// <summary> /// Generic node class for AATree. /// </summary> /// <typeparam name="TKey">Type of key for node.</typeparam> public class AaTreeNode<TKey> { /// <summary> /// Initializes a new instance of the <see cref="AaTreeNode{TKey...
41
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; namespace DataStructures.AVLTree { /// <summary> /// A simple self-balancing binary tree. /// </summary> /// <remarks> /// An AVL tree is a self-balancing binary search tree (BST) named after /// its inventors: Adelson, Velsky, and Lan...
427
C-Sharp
TheAlgorithms
C#
using System; namespace DataStructures.AVLTree { /// <summary> /// Generic class to represent nodes in an <see cref="AvlTree{TKey}"/> /// instance. /// </summary> /// <typeparam name="TKey">The type of key for the node.</typeparam> internal class AvlTreeNode<TKey> { /// <sum...
75
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; namespace DataStructures.BinarySearchTree { /// <summary> /// An ordered tree with efficient insertion, removal, and lookup. /// </summary> /// <remarks> /// A Binary Search Tree (BST) is a tree that satisfies the following properties: ...
405
C-Sharp
TheAlgorithms
C#
namespace DataStructures.BinarySearchTree { /// <summary> /// Generic node class for BinarySearchTree. /// Keys for each node are immutable. /// </summary> /// <typeparam name="TKey">Type of key for the node. Keys must implement IComparable.</typeparam> public class BinarySearchTreeNo...
32
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; namespace DataStructures.Cache { /// <summary> /// Least Frequently Used (LFU) cache implementation. /// </summary> /// <typeparam name="TKey">The type of the key (must be not null).</typeparam> /// <typeparam name="TValue">The type of the value.</typ...
159
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; namespace DataStructures.Cache { /// <summary> /// Least Recently Used (LRU) cache implementation. /// </summary> /// <typeparam name="TKey">The type of the key (must be not null).</typeparam> /// <typeparam name="TValue">The type of the value.</typep...
113
C-Sharp
TheAlgorithms
C#
using System.Collections; namespace DataStructures.DisjointSet { /// <summary> /// Implementation of Disjoint Set with Union By Rank and Path Compression heuristics. /// </summary> /// <typeparam name="T"> generic type for implementation.</typeparam> public class DisjointSet<T> { /// <s...
63
C-Sharp
TheAlgorithms
C#
namespace DataStructures.DisjointSet { /// <summary> /// node class to be used by disjoint set to represent nodes in Disjoint Set forest. /// </summary> /// <typeparam name="T">generic type for data to be stored.</typeparam> public class Node<T> { public int Rank { get; set; } p...
22
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; namespace DataStructures.Graph { /// <summary> /// Implementation of the directed weighted graph via adjacency matrix. /// </summary> /// <typeparam name="T">Generic Type.</typeparam> public class DirectedWeightedGraph<T> : IDirectedWeightedGra...
202
C-Sharp
TheAlgorithms
C#
using System.Collections.Generic; namespace DataStructures.Graph { public interface IDirectedWeightedGraph<T> { int Count { get; } Vertex<T>?[] Vertices { get; } void AddEdge(Vertex<T> startVertex, Vertex<T> endVertex, double weight); Vertex<T> AddVertex(T data); boo...
26
C-Sharp
TheAlgorithms
C#
namespace DataStructures.Graph { /// <summary> /// Implementation of graph vertex. /// </summary> /// <typeparam name="T">Generic Type.</typeparam> public class Vertex<T> { /// <summary> /// Gets vertex data. /// </summary> public T Data { get; } ...
60
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; namespace DataStructures.Heap { /// <summary> /// A generic implementation of a binary heap. /// </summary> /// <remarks> /// A binary heap is a complete binary tree that satisfies the heap property; /// that is every node in the tr...
238
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; using System.Linq; namespace DataStructures.Heap { /// <summary> /// This class implements min-max heap. /// It provides functionality of both min-heap and max-heap with the same time complexity. /// Therefore it provides constant time retr...
382
C-Sharp
TheAlgorithms
C#
using System; namespace DataStructures.Heap.FibonacciHeap { /// <summary> /// These FHeapNodes are the bulk of the data structure. The have pointers to /// their parent, a left and right sibling, and to a child. A node and its /// siblings comprise a circularly doubly linked list. /// <...
133
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; using System.Linq; namespace DataStructures.Heap.FibonacciHeap { /// <summary> /// A generic implementation of a Fibonacci heap. /// </summary> /// <remarks> /// <para> /// A Fibonacci heap is similar to a standard binary heap ...
464
C-Sharp
TheAlgorithms
C#
using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DataStructures.Heap.PairingHeap { /// <summary> /// A pairing minMax heap implementation. /// </summary> /// <typeparam name="T">Base type.</typeparam> public class PairingHeap<T> : IEnumerable...
256
C-Sharp
TheAlgorithms
C#
using System; namespace DataStructures.Heap.PairingHeap { /// <summary> /// Node represented the value and connections. /// </summary> /// <typeparam name="T">Type, supported comparing.</typeparam> public class PairingHeapNode<T> { public PairingHeapNode(T value) { ...
27
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; namespace DataStructures.Heap.PairingHeap { /// <summary> /// Node comparer. /// </summary> /// <typeparam name="T">Node type.</typeparam> public class PairingNodeComparer<T> : IComparer<T> where T : IComparable { private readonly bool ...
34
C-Sharp
TheAlgorithms
C#
namespace DataStructures.Heap.PairingHeap { public enum Sorting { /// <summary> /// Ascending order. /// </summary> Ascending = 0, /// <summary> /// Descending order. /// </summary> Descending = 1, } }
16
C-Sharp
TheAlgorithms
C#
using System; using System.Collections.Generic; using Utilities.Exceptions; namespace DataStructures.LinkedList.DoublyLinkedList { /// <summary> /// Similar to a Singly Linked List but each node contains a refenrence to the previous node in the list. /// <see cref="System.Collections.Generic.Linked...
335
C-Sharp
TheAlgorithms
C#
namespace DataStructures.LinkedList.DoublyLinkedList { /// <summary> /// Generic node class for Doubly Linked List. /// </summary> /// <typeparam name="T">Generic type.</typeparam> public class DoublyLinkedListNode<T> { /// <summary> /// Initializes a new instance of the ...
31