Skip to content

Repository files navigation


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 StatusReleaseLicenseStars

.NET 10TestsData StructuresAlgorithms


⚡ 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:PrimeHashingFamilyUniversalHashingFamily

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.

About

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

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages