README.md

January 8, 2026 ยท View on GitHub


                                          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
TypeSparseDense
UndirectedUndirectedSparseGraphUndirectedDenseGraph
Undirected WeightedUndirectedWeightedSparseGraphUndirectedWeightedDenseGraph
DirectedDirectedSparseGraphDirectedDenseGraph
Directed WeightedDirectedWeightedSparseGraphDirectedWeightedDenseGraph

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.