aalhour/C-Sharp-Algorithms

📚 📈 Plug-and-play class-library project of standard Data Structures and Algorithms in C#

C#

6,167

663 commits

updated Oct 15, 2026

See the code

README


                                          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 

A plug-and-play library of classic data structures and algorithms in C#

Build Status Release License Stars

.NET 10 Tests Data Structures Algorithms


⚡ Quick Start

# Clone the repository
git clone https://github.com/aalhour/C-Sharp-Algorithms.git
cd C-Sharp-Algorithms

# Build and test
dotnet build
dotnet test

Requirements: .NET 10.0 SDK or later


📖 About

This project started as interview prep and evolved into a comprehensive reference implementation of classic computer science data structures and algorithms. Every component is:

  • Educational — Clear, readable implementations with documentation
  • Tested — 623+ unit tests ensuring correctness
  • Modular — Use only what you need

Project Structure

ProjectDescription
AlgorithmsSorting, searching, graph algorithms, and more
DataStructuresLists, trees, heaps, hash tables, graphs
UnitTestComprehensive test coverage

📦 Data Structures

Lists & Collections
StructureDescription
ArrayListDynamic array with auto-resizing
StackLIFO collection
QueueFIFO collection
SLinkedListSingly-linked list
DLinkedListDoubly-linked list
SkipListProbabilistic balanced structure
CircularBufferFixed-size circular queue
Heaps & Priority Queues
StructureDescription
BinaryMinHeapMin-heap using binary tree
BinaryMaxHeapMax-heap using binary tree
BinomialMinHeapBinomial heap (min)
MinPriorityQueuePriority queue (min)
KeyedPriorityQueueKey-value priority queue
Hash Tables
StructureDescription
ChainedHashTableSeparate chaining collision resolution
CuckooHashTableCuckoo hashing
OpenScatterHashTableLinear probing
OpenAddressingHashTableOpen addressing with double hashing

Hashing Functions: PrimeHashingFamily ・ UniversalHashingFamily

Trees

Search Trees

StructureDescription
BinarySearchTreeClassic BST (Map version)
AugmentedBinarySearchTreeBST with subtree counts
TernarySearchTreeFor string keys

Self-Balancing Trees

StructureDescription
AVLTreeHeight-balanced BST
RedBlackTreeColor-balanced BST (Map version)
BTreeB-tree for disk-based storage

Prefix Trees

StructureDescription
TriePrefix tree for strings
TrieMapAssociative prefix tree
Graphs

Also: CliqueGraph

Sorted Collections
StructureDescription
SortedListAlways-sorted list
SortedDictionarySorted key-value store

🔧 Algorithms

Sorting (16 algorithms)
AlgorithmTypeComplexity
QuickSortDivide & ConquerO(n log n) avg
MergeSortDivide & ConquerO(n log n)
HeapSortSelectionO(n log n)
InsertionSortInsertionO(n²)
SelectionSortSelectionO(n²)
BubbleSortExchangeO(n²)
ShellSortInsertionO(n log² n)
CombSortExchangeO(n²)
CountingSortNon-comparisonO(n + k)
LSD RadixSortNon-comparisonO(nk)
BucketSortDistributionO(n + k)
BSTSortTree-basedO(n log n)
CycleSortIn-placeO(n²)
GnomeSortExchangeO(n²)
OddEvenSortExchangeO(n²)
PigeonHoleSortDistributionO(n + k)
Graph Algorithms

Traversal

Shortest Paths

Applications

Trees, Strings & Numeric

Tree Traversal

String Algorithms

Numeric

Visualization

Searching

🚀 Roadmap

See TODO.md for planned additions. Highlights:

  • Data Structures: Bloom Filters, Fibonacci Heaps, Disjoint Sets, Suffix Trees
  • Algorithms: A* Search, Minimum Spanning Trees, String Matching (KMP, Boyer-Moore)

🤝 Contributing

Contributions welcome! Please read the Contribution Guidelines first.


📄 License

This project is licensed under the MIT License.

algorithms
binary-trees
csharp
data-structures
graph
graph-algorithms
hashing
hashing-algorithms
heaps
queues
searching
searching-algorithms
sorting
sorting-algorithms
tree
tree-algorithms

aalhour/C-Sharp-Algorithms

📚 📈 Plug-and-play class-library project of standard Data Structures and Algorithms in C#

C#

6,167

663 commits

updated Oct 15, 2026

See the code

README


                                          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 

A plug-and-play library of classic data structures and algorithms in C#

Build Status Release License Stars

.NET 10 Tests Data Structures Algorithms


⚡ Quick Start

# Clone the repository
git clone https://github.com/aalhour/C-Sharp-Algorithms.git
cd C-Sharp-Algorithms

# Build and test
dotnet build
dotnet test

Requirements: .NET 10.0 SDK or later


📖 About

This project started as interview prep and evolved into a comprehensive reference implementation of classic computer science data structures and algorithms. Every component is:

  • Educational — Clear, readable implementations with documentation
  • Tested — 623+ unit tests ensuring correctness
  • Modular — Use only what you need

Project Structure

ProjectDescription
AlgorithmsSorting, searching, graph algorithms, and more
DataStructuresLists, trees, heaps, hash tables, graphs
UnitTestComprehensive test coverage

📦 Data Structures

Lists & Collections
StructureDescription
ArrayListDynamic array with auto-resizing
StackLIFO collection
QueueFIFO collection
SLinkedListSingly-linked list
DLinkedListDoubly-linked list
SkipListProbabilistic balanced structure
CircularBufferFixed-size circular queue
Heaps & Priority Queues
StructureDescription
BinaryMinHeapMin-heap using binary tree
BinaryMaxHeapMax-heap using binary tree
BinomialMinHeapBinomial heap (min)
MinPriorityQueuePriority queue (min)
KeyedPriorityQueueKey-value priority queue
Hash Tables
StructureDescription
ChainedHashTableSeparate chaining collision resolution
CuckooHashTableCuckoo hashing
OpenScatterHashTableLinear probing
OpenAddressingHashTableOpen addressing with double hashing

Hashing Functions: PrimeHashingFamily ・ UniversalHashingFamily

Trees

Search Trees

StructureDescription
BinarySearchTreeClassic BST (Map version)
AugmentedBinarySearchTreeBST with subtree counts
TernarySearchTreeFor string keys

Self-Balancing Trees

StructureDescription
AVLTreeHeight-balanced BST
RedBlackTreeColor-balanced BST (Map version)
BTreeB-tree for disk-based storage

Prefix Trees

StructureDescription
TriePrefix tree for strings
TrieMapAssociative prefix tree
Graphs

Also: CliqueGraph

Sorted Collections
StructureDescription
SortedListAlways-sorted list
SortedDictionarySorted key-value store

🔧 Algorithms

Sorting (16 algorithms)
AlgorithmTypeComplexity
QuickSortDivide & ConquerO(n log n) avg
MergeSortDivide & ConquerO(n log n)
HeapSortSelectionO(n log n)
InsertionSortInsertionO(n²)
SelectionSortSelectionO(n²)
BubbleSortExchangeO(n²)
ShellSortInsertionO(n log² n)
CombSortExchangeO(n²)
CountingSortNon-comparisonO(n + k)
LSD RadixSortNon-comparisonO(nk)
BucketSortDistributionO(n + k)
BSTSortTree-basedO(n log n)
CycleSortIn-placeO(n²)
GnomeSortExchangeO(n²)
OddEvenSortExchangeO(n²)
PigeonHoleSortDistributionO(n + k)
Graph Algorithms

Traversal

Shortest Paths

Applications

Trees, Strings & Numeric

Tree Traversal

String Algorithms

Numeric

Visualization

Searching

🚀 Roadmap

See TODO.md for planned additions. Highlights:

  • Data Structures: Bloom Filters, Fibonacci Heaps, Disjoint Sets, Suffix Trees
  • Algorithms: A* Search, Minimum Spanning Trees, String Matching (KMP, Boyer-Moore)

🤝 Contributing

Contributions welcome! Please read the Contribution Guidelines first.


📄 License

This project is licensed under the MIT License.

algorithms
binary-trees
csharp
data-structures
graph
graph-algorithms
hashing
hashing-algorithms
heaps
queues
searching
searching-algorithms
sorting
sorting-algorithms
tree
tree-algorithms

Project health

Overall

3.8/10

Maintained

5/10

Code review

2/10
OpenSSF Scorecard

Significant stargazers

David

1,104 followers · starred Aug 2023

Dan Rigby

242 followers · starred Aug 2021

Andrew Savinykh

25 followers · starred Nov 2019

aybe

71 followers · starred Aug 2019