README.md
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
# 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
This project started as interview prep and evolved into a comprehensive reference implementation of classic computer science data structures and algorithms. Every component is:
| Project | Description |
|---|---|
Algorithms | Sorting, searching, graph algorithms, and more |
DataStructures | Lists, trees, heaps, hash tables, graphs |
UnitTest | Comprehensive test coverage |
| 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 |
| 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 |
| Structure | Description |
|---|---|
| ChainedHashTable | Separate chaining collision resolution |
| CuckooHashTable | Cuckoo hashing |
| OpenScatterHashTable | Linear probing |
| OpenAddressingHashTable | Open addressing with double hashing |
Hashing Functions: PrimeHashingFamily ・ UniversalHashingFamily
</details> <details> <summary><strong>Trees</strong></summary>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 |
| Type | Sparse | Dense |
|---|---|---|
| Undirected | UndirectedSparseGraph | UndirectedDenseGraph |
| Undirected Weighted | UndirectedWeightedSparseGraph | UndirectedWeightedDenseGraph |
| Directed | DirectedSparseGraph | DirectedDenseGraph |
| Directed Weighted | DirectedWeightedSparseGraph | DirectedWeightedDenseGraph |
Also: CliqueGraph
</details> <details> <summary><strong>Sorted Collections</strong></summary>| Structure | Description |
|---|---|
| SortedList | Always-sorted list |
| SortedDictionary | Sorted key-value store |
| 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) |
Traversal
Shortest Paths
Applications
</details> <details> <summary><strong>Trees, Strings & Numeric</strong></summary>Tree Traversal
String Algorithms
Numeric
Visualization
</details> <details> <summary><strong>Searching</strong></summary> </details>See TODO.md for planned additions. Highlights:
Contributions welcome! Please read the Contribution Guidelines first.
<a href="https://github.com/aalhour/C-Sharp-Algorithms/graphs/contributors"> </a>This project is licensed under the MIT License.