Skip to content
项目

关于

使用 C# 泛型实现的 100 多种算法和数据结构。

学习与教育

这些数字如何统计

实测星标增长

24小时
0
7天
+1
15天
+1
1个月
+1

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Note:

This is a maintained, curiosity-driven personal project that was originally not intended to be a library. Issues and pull requests for bug fixes, new algorithms, and data structures are welcome. Feel free to fork and modify the project to fit your needs.

Advanced Algorithms

Various important computer science algorithms generically implemented in C#.

Build NuGet NuGet downloads

Install by nuget

For beta releases on beta branch

Install-Package Advanced.Algorithms -Pre

For stable releases on stable branch

Install-Package Advanced.Algorithms

Supports

  • .NET Standard 2.0 (covers .NET Framework 4.6.1+ and all modern .NET)

Development environment

Requires the .NET 10 SDK.

  • Visual Studio 2022+ or JetBrains Rider

Data structures

List

HashSets

Dictionaries

Stack

Queue

Linked list

Heap

Note: It is observed that among the implementations here, in practice, with the exclusion of UpdateKey (decrement/increment) operation, regular Binary Heap & d-ary Heap outperforms other in theory superiors. Likely because it doesn't have pointer juggling overhead and hey arrays are faster!

Tree

Binary search trees

B trees (database trees)

Queryable trees

TODO: Support multi-dimentional segment tree & binary indexed tree.

Lookup trees

TODO: implement trie compression.

Set

Graph

Adjacency list

Adjacency matrix

Algorithms

Graph algorithms

Articulation points

Bridges

Connectivity

Coloring

Cover

Maximum flow

Shortest path

Matching

  • Max bipartite matching (implementation | tests) using Edmonds Karp's improved Ford Fulkerson max flow algorithm
  • Max bipartite matching (implementation | tests) using Hopcroft Karp algorithm

Cut

  • Minimum cut (implementation | tests) using Edmonds Karp's improved Ford Fulkerson max flow algorithm

Cycle

Search

Topological sort

Minimum spanning tree

String

Pattern matching

Compression

Sorting and searching

Sorting algorithms

Note: On a decent desktop, in given implementations here for +ive random input integers, the clear winner is counting sort (~0.1 seconds to sort 1 million integers) followed by Radix Sort (~0.4 seconds). Merge Sort, Heap Sort, Quick Sort & Bucket Sort are all winners for +ive & -ive random integer inputs. Tree sort has pointer juggling overhead on backing Red-Black Tree, so performs 8 times slower than Merge Sort in practice. Bubble Sort, Insertion Sort, Selection Sort & Shell Sort are among the worst for random input as observed from results.

Combinatorics

Distributed Systems

Numerical methods

Geometry (in 2D)

Bit manipulation

Code quality

Quality Gate Coverage Lines of Code Bugs Vulnerabilities Code Smells Security Rating Reliability Rating Maintainability Rating Duplicated Lines Technical Debt

探索相关项目

加载中…