Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

C-Sharp-Algorithms

> 编程语言
Open source

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

6.2K stars0 likes1 views
WebsiteGitHub

About

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

…

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


⚡ Quick Start

bash
# 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

Project Description
Algorithms Sorting, searching, graph algorithms, and more
DataStructures Lists, trees, heaps, hash tables, graphs
UnitTest Comprehensive test coverage

Data Structures

Lists & Collections
Structure Description
ArrayList Dynamic array with auto-resizing
Stack LIFO collection
Queue FIFO collection
SLinkedList Singly-linked list
DLinkedList Doubly-linked list
SkipList Probabilistic balanced structure
CircularBuffer Fixed-size circular queue
Heaps & Priority Queues
Structure Description
BinaryMinHeap Min-heap using binary tree
BinaryMaxHeap Max-heap using binary tree
BinomialMinHeap Binomial heap (min)
MinPriorityQueue Priority queue (min)
KeyedPriorityQueue Key-value priority queue
Hash Tables
Structure Description
ChainedHashTable Separate chaining collision resolution
CuckooHashTable Cuckoo hashing
OpenScatterHashTable Linear probing
OpenAddressingHashTable Open addressing with double hashing

Hashing Functions: PrimeHashingFamily ・ UniversalHashingFamily

Trees

Search Trees

Structure Description
BinarySearchTree Classic BST (Map version)
AugmentedBinarySearchTree BST with subtree counts
TernarySearchTree For string keys

Self-Balancing Trees

Structure Description
AVLTree Height-balanced BST
RedBlackTree Color-balanced BST (Map version)
BTree B-tree for disk-based storage

Prefix Trees

Structure Description
Trie Prefix tree for strings
TrieMap Associative prefix tree
Graphs
Type Sparse Dense
Undirected UndirectedSparseGraph UndirectedDenseGraph
Undirected Weighted UndirectedWeightedSparseGraph UndirectedWeightedDenseGraph
Directed DirectedSparseGraph DirectedDenseGraph
Directed Weighted DirectedWeightedSparseGraph DirectedWeightedDenseGraph

Also: CliqueGraph

Sorted Collections
Structure Description
SortedList Always-sorted list
SortedDictionary Sorted key-value store

Algorithms

Sorting (16 algorithms)
Algorithm Type Complexity
QuickSort Divide & Conquer O(n log n) avg
MergeSort Divide & Conquer O(n log n)
HeapSort Selection O(n log n)
InsertionSort Insertion O(n²)
SelectionSort Selection O(n²)
BubbleSort Exchange O(n²)
ShellSort Insertion O(n log² n)
CombSort Exchange O(n²)
CountingSort Non-comparison O(n + k)
LSD RadixSort Non-comparison O(nk)
BucketSort Distribution O(n + k)
BSTSort Tree-based O(n log n)
CycleSort In-place O(n²)
GnomeSort Exchange O(n²)
OddEvenSort Exchange O(n²)
PigeonHoleSort Distribution O(n + k)
Graph Algorithms

Traversal

  • Depth-First Search
  • Breadth-First Search

Shortest Paths

  • Dijkstra — Single-source, non-negative weights
  • Dijkstra All-Pairs — All pairs shortest paths
  • Bellman-Ford — Handles negative weights
  • BFS Shortest Paths — Unweighted graphs

Applications

  • Cycle Detection
  • Topological Sort
  • Connected Components
  • Bipartite Coloring
Trees, Strings & Numeric

Tree Traversal

  • Recursive Walker — Preorder, Inorder, Postorder
  • Iterative Walker — Stack-based traversal

String Algorithms

  • Permutations & Anagrams
  • Edit Distance (Levenshtein)

Numeric

  • Binomial Coefficients
  • Catalan Numbers
  • Greatest Common Divisor
  • Sieve of Eratosthenes
  • Sieve of Atkin

Visualization

  • Tree Drawer
Searching
  • Binary Search

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.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#algorithmsbinary-treescsharpdata-structures

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言