C-Sharp-Algorithms icon indicating copy to clipboard operation
C-Sharp-Algorithms copied to clipboard

:books: :chart_with_upwards_trend: Plug-and-play class-library project of standard Data Structures and Algorithms in C#


                                          o---o    |   |                                 
                                         /       --O---O--                               
                                        O          |   |                                 
                                         \       --O---O--                               
                                          o---o    |   |                                 


              O    o       o--o    o--o   o---o   o-O-o  o--O--o  o   o  o     o   o--o 
             / \   |      o       o    o  |   |     |       |     |   |  |\   /|  |     
            o---o  |      |  o-o  |    |  O--Oo     |       |     O---O  | \o/ |   o--o 
            |   |  |      o    |  o    o  |  \      |       |     |   |  |     |      | 
            o   o  O---o   o--o    o--o   o   \o  o-O-o     o     o   o  o     o  o---o 

WHAT IS C# ALGORITHMS?

A plug-and-play class-library project of standard Data Structures and Algorithms, written in C#. It contains 75+ Data Structures and Algorithms, designed as Object-Oriented isolated components. Even though this project started for educational purposes, the implemented Data Structures and Algorithms are standard, efficient, stable and tested.

BACK STORY

This project originally started out as an interview preparation project. However, after receiving a great amount of positive responses on reddit, and noticing excitement from a few GitHubers to contribute furthermore to it, the project took on a different meaning. So, I decided to keep maintaining it as a reference for data structures and algorithm implementations in C# as well as my own research side-project under these topics.

DESCRIPTION

Solution Hierarchy:

This is a C#.NET solution-project, and it contains three subprojects:

  1. Algorithms: A class library project. Contains the Algorithms implementations
  2. Data Structures: A class library project. Contains the Data Structures implementations
  3. UnitTest: Unit-testing project for the Algorithms and Data Structures

Requirements:

  1. .NET Core >= 2.0
  2. XUnit

A Note to Contributors:

If you wish to contribute to C# ALGORITHMS, then please make sure you check out the Contribution Guidelines first.

DATA STRUCTURES

Linear:

  • Skip List
  • Array List
  • Stack
  • Queue
  • Single-Linked List
  • Double-Linked List

Circular:

  • Circular Buffer

Heaps:

  • Binary-Min Heap
  • Binary-Max Heap
  • Binomial-Min Heap

Priority Queues:

  • Min-Priority Queue
  • Key-value Priority Queue

Hashing Functions:

  • Prime Hashing Family
  • Universal Hashing Family

Hash Tables:

  • Chained Hash Table
  • Cuckoo Hash Table
  • Open-Addressing Hash Table

Sorted Collections (Tree-based):

  • Sorted List
  • Sorted Dictionary

Trees:

  • Basic Search Trees:
    • Binary Search Tree
      • Map version (supports key-value pairing; nodes indexed by keys)
    • (Augmented) Binary Search Tree
    • Ternary Search Tree
  • Self-Balancing Trees:
    • AVL Tree
    • B-Tree
    • Red-Black Tree
      • Map version (supports key-value pairing; nodes indexed by keys)
  • Prefix Trees:
    • Trie
    • Trie Map (associative prefix tree; complete words are keys to records)

Graphs:

  • Undirected Graphs:
    • Clique Graphs
    • Undirected Sparse Graph
    • Undirected Dense Graph
  • Undirected Weighted Graphs:
    • Undirected Weighted Sparse Graph
    • Undirected Weighted Dense Graph
  • Directed Graphs:
    • Directed Sparse Graph
    • Directed Dense Graph
  • Directed Weighted Graphs:
    • Directed Weighted Sparse Graph
    • Directed Weighted Dense Graph

ALGORITHMS

Sorting:

  • Bubble Sort
  • Bucket Sort
  • BST Sort
  • Comb Sort
  • Counting Sort
  • Cycle Sort
  • Gnome Sort
  • Heap Sort
  • Insertion Sort
  • LSD Radix Sort
  • Merge Sort
  • Selection Sort
  • Shell Sort
  • OddEven Sort
  • PigeonHole Sort
  • Quick Sort

Searching:

  • Binary Search

Graphs:

  • Graph Search:
    • Depth-First Searcher
    • Breadth-First Searcher
  • Shortest Paths:
    • Breadth-First SPs
    • Bellman-Ford SPs
    • Dijkstra SPs
    • Dijkstra All-Pairs SPs
  • DFS Applications:
    • Cycles Detector
    • Topological Sorter
  • BFS Applications:
    • Connected Components
    • Bipartite Graphs Coloring

Trees:

  • Recursive Binary Tree Walker
    • Methods: PrintAll, ForEach, Contains and BinarySearch. Traversal Modes: Preorder, Inorder & Postorder

Strings:

  • Permutations and Anagrams
  • Edit Distance
    • Uses a generic custom class for passing costs: EditDistanceCostsMap<T>

Numeric:

  • Binomial Coefficients
  • Catalan Numbers
  • Greatest Common Divisor

Visualization:

  • Tree Drawer

CONTRIBUTORS


LICENSE

This project is licensed under the MIT License.