C#中标准数据结构和算法的即插即用类库项目
GitHub:https://github.com/aalhour/C-Sharp-Algorithms
Watch: 307 Star: 3.4k Fork: 910
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
什么是C# 算法
标准数据结构和算法的即插即用类库项目,使用C#编写。它包含75多种数据结构和算法,被设计为面向对象的隔离组件。即使该项目出于教育目的而开始,但已实现的数据结构和算法都是标准、高效、稳定和经过测试的。
背后的故事
该项目最初是作为面试准备项目开始的。但是,在收到有关reddit
的大量积极响应,并注意到一些GitHubers
为它做出进一步贡献而感到兴奋之后,该项目的含义有所不同。因此,我决定继续对其进行维护,以作为C#中数据结构和算法实现以及这些主题下我自己的研究副项目的参考。
描述
解决方案层次结构
这是一个C#.NET解决方案,它包含三个子项目:
Algorithms
: 一个类库项目。包含算法实现Data Structures
: 一个类库项目。包含数据结构实现UnitTest
:对算法和数据结构实现的测试项目
要求
- .NET Core>=2.0
- XUnit
投稿者须知
如果你想为C#算法做出共享,请确保你首先查看贡献准则。
数据结构
Linear:
- Skip List
- Array List
- Stack
- Queue
- Single-Linked List
- Double-Linked List
Circlar:
- Circular Buffer
Heaps:
- Binary-Min Heap
- Binary-Max Heap
- Binomial-Min Heap
Priority Queues:
- Min-Priority Queue
- Key-value Priority Queue
Hashing Functions:
- Prime Hashing Family
- Universal Hashing Family
Hash Tables:
- Chained Hash Table
- Cuckoo Hash Table
- Open-Addressing Hash Table
Sorted Collections(Tree-based):
- Sorted List
- Sorted Dictionary
Trees:
- Basic Search Trees:
- Binary Search Tree
- Map versions(Supports key-value pairing; nodes indexed by keys)
- (Augmented) Binary Search Tree
- Ternary Search Tree
- Binary Search Tree
- Self-Balancing Trees:
- AVL Tree
- B-Tree
- Red-Black Tree
- Map version(supports key-value pairing;nodes indexed by keys)
- Prefix Trees:
- Trie
- Trie Map (associative prefix tree;complete words are keys to records)
Graphs:
- Undirected Graphs:
- Clique Graphs
- Undirected Sparse Graph
- Undirected Dense Graph
- Undirected Weighted Graphs:
- Undirected Weighted Sparse Graph
- Undirected Weighted Dense Graph
- Directed Graphs:
- Directed Sparse Graph
- Directed Dense Graph
- Directed Weighted Graphs:
- Directed Weighted Sparse Graph
- Directed Weighted Dense Graph
算法
排序算法(Sorting):
- Bubble Sort
- Bucket Sort
- BST Sort
- Comb Sort
- Counting Sort
- Cycle Sort
- Gnome Sort
- Heap Sort
- Insertion Sort
- LSD Radix Sort
- Merge Sort
- Selection Sort
- Shell Sort
- OddEven Sort
- PigeonHole Sort
- Quick Sort
Searching:
- Binary Search
Graphs:
- Graph Search:
- Depth-Frist Searcher
- Breadth-First Searcher
- Shortest Paths:
- Breadth-First SPs
- Bellman-Ford SPs
- Dijkstra SPs
- Dijkstra All-Pairs SPs
- DFS Applications:
- Cycles Detector
- Topological Sorter
- BFS Applications:
- Connected Components
- Biparite Graphs Coloring
Tree:
- Resursive Binary Tree Walker
- Methods: PrintAll, ForEach, Contains and BinarySearch. Traversal Modes: Preorder, Inorder & Postorder
Strings:
- Permutations and Anagrams
- Edit Distance
- Uses a generic custom class for passing costs: EditDistanceCostsMap
Numeric:
- Binomial Coefficients
- Catalan Numbers
- Greatest Common Divisor
Visualization:
- Tree Drawer