aalhour/C-Sharp-Algorithms
:books: :chart_with_upwards_trend: Plug-and-play class-library project of standard Data Structures and Algorithms in C#
Healthy across the board
Permissive license, no critical CVEs, actively maintained — safe to depend on.
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
No critical CVEs, sane security posture — runnable as-is.
- ✓Last commit 1w ago
- ✓11 active contributors
- ✓Distributed ownership (top contributor 39% of recent commits)
Show 3 more →Show less
- ✓MIT licensed
- ✓CI configured
- ⚠No test directory detected
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the "Healthy" badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/aalhour/c-sharp-algorithms)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card (1200×630)
This card auto-renders when someone shares https://repopilot.app/r/aalhour/c-sharp-algorithms on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: aalhour/C-Sharp-Algorithms
Generated by RepoPilot · 2026-05-09 · Source
🤖Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/aalhour/C-Sharp-Algorithms shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
🎯Verdict
GO — Healthy across the board
- Last commit 1w ago
- 11 active contributors
- Distributed ownership (top contributor 39% of recent commits)
- MIT licensed
- CI configured
- ⚠ No test directory detected
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
✅Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live aalhour/C-Sharp-Algorithms
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/aalhour/C-Sharp-Algorithms.
What it runs against: a local clone of aalhour/C-Sharp-Algorithms — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in aalhour/C-Sharp-Algorithms | Confirms the artifact applies here, not a fork |
| 2 | License is still MIT | Catches relicense before you depend on it |
| 3 | Default branch master exists | Catches branch renames |
| 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code |
| 5 | Last commit ≤ 39 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of aalhour/C-Sharp-Algorithms. If you don't
# have one yet, run these first:
#
# git clone https://github.com/aalhour/C-Sharp-Algorithms.git
# cd C-Sharp-Algorithms
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of aalhour/C-Sharp-Algorithms and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "aalhour/C-Sharp-Algorithms(\\.git)?\\b" \\
&& ok "origin remote is aalhour/C-Sharp-Algorithms" \\
|| miss "origin remote is not aalhour/C-Sharp-Algorithms (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(MIT)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"MIT\"" package.json 2>/dev/null) \\
&& ok "license is MIT" \\
|| miss "license drift — was MIT at generation time"
# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
&& ok "default branch master exists" \\
|| miss "default branch master no longer exists"
# 4. Critical files exist
test -f "DataStructures/Graphs/IGraph.cs" \\
&& ok "DataStructures/Graphs/IGraph.cs" \\
|| miss "missing critical file: DataStructures/Graphs/IGraph.cs"
test -f "DataStructures/Lists/DLinkedList.cs" \\
&& ok "DataStructures/Lists/DLinkedList.cs" \\
|| miss "missing critical file: DataStructures/Lists/DLinkedList.cs"
test -f "DataStructures/Heaps/IMinHeap.cs" \\
&& ok "DataStructures/Heaps/IMinHeap.cs" \\
|| miss "missing critical file: DataStructures/Heaps/IMinHeap.cs"
test -f "Algorithms/Graphs/BellmanFordShortestPaths.cs" \\
&& ok "Algorithms/Graphs/BellmanFordShortestPaths.cs" \\
|| miss "missing critical file: Algorithms/Graphs/BellmanFordShortestPaths.cs"
test -f "Algorithms/Sorting/QuickSorter.cs" \\
&& ok "Algorithms/Sorting/QuickSorter.cs" \\
|| miss "missing critical file: Algorithms/Sorting/QuickSorter.cs"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 39 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~9d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/aalhour/C-Sharp-Algorithms"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
⚡TL;DR
A comprehensive C# class library providing production-ready implementations of 35+ classic data structures and 40+ algorithms across graphs, sorting, searching, numeric computation, and string processing. Built as a plug-and-play reference with 623+ passing unit tests, it eliminates the need to implement BFS, Dijkstra, merge sort, or binary search trees from scratch in .NET projects. Simple monolithic structure: two main projects at root—Algorithms/ contains organized subdirectories by domain (Algorithms/Graphs/, Algorithms/Sorting/, Algorithms/Search/, Algorithms/Numeric/, Algorithms/Strings/). Common utilities live in Algorithms/Common/ (Comparers.cs, Helpers.cs). Test projects mirror this structure. Each algorithm/data structure is a standalone class file.
👥Who it's for
C# developers preparing for technical interviews, students learning DSA, and .NET engineers building systems that need reference implementations of graph algorithms (shortest paths, cycle detection), advanced sorting techniques, or numeric algorithms without hunting through academic papers or reinventing the wheel.
🌱Maturity & risk
Actively maintained and production-ready. The repository has 623+ passing tests, CI/CD configured via GitHub Actions (build_and_test.yml), targets .NET 10.0 SDK, and follows semantic versioning with releases. The project shows consistent care: it has CODE_OF_CONDUCT, CONTRIBUTING guidelines, and standardized issue templates.
Low risk. Single maintainer (aalhour) is a structural concern for long-term sustainability, but the codebase is stable—it's a data structures/algorithms library with minimal external dependencies (primarily .NET BCL). No breaking changes visible in recent activity. Main risk: if the maintainer becomes unavailable, community forks might fragment the project.
Active areas of work
Active maintenance with recent build/test workflow integration. The repository is oriented toward steady improvement: issue templates guide contributors toward specific requests (ALGORITHM_REQUEST, BUG_REPORT, DATA_STRUCTURE_REQUEST, FEATURE_REQUEST), suggesting organized community development. No major breaking changes visible—incremental additions and polish.
🚀Get running
git clone https://github.com/aalhour/C-Sharp-Algorithms.git
cd C-Sharp-Algorithms
dotnet build
dotnet test
Requires .NET 10.0 SDK or later.
Daily commands:
This is a library, not an executable service. Build with dotnet build. Run unit tests with dotnet test. To use in your own project, reference Algorithms.csproj or consume compiled binaries.
🗺️Map of the codebase
DataStructures/Graphs/IGraph.cs— Core graph interface that all graph implementations extend; essential to understand the abstraction for graph-based algorithms.DataStructures/Lists/DLinkedList.cs— Doubly-linked list is a foundational data structure used across the codebase; critical for understanding node-based collections.DataStructures/Heaps/IMinHeap.cs— Min heap interface defines the contract for priority queue and heap-based algorithms; foundational for sorting and graph algorithms.Algorithms/Graphs/BellmanFordShortestPaths.cs— Represents a complex algorithm that depends on graph structure abstraction; exemplifies how algorithms interact with data structures.Algorithms/Sorting/QuickSorter.cs— Quicksort is one of the most heavily-used sorting algorithms; demonstrates the sorting abstraction pattern used throughout.DataStructures/Dictionaries/ChainedHashTable.cs— Hash table implementation with collision handling is fundamental to dictionary-based operations and performance characteristics.DataStructures/Trees/AVLTree.cs— Self-balancing tree structure is a complex data structure combining insertion, deletion, and balancing logic; demonstrates advanced DS patterns.
🛠️How to make changes
Add a New Sorting Algorithm
- Create a new class in Algorithms/Sorting/ that implements a static Sort method, e.g., TimSorter.cs (
Algorithms/Sorting/[NewSorter].cs) - Follow the pattern from QuickSorter.cs or MergeSorter.cs: implement a public static void Sort<T>(T[] array, Comparer<T> comparer = null) method (
Algorithms/Sorting/QuickSorter.cs) - Use Comparers.cs from Algorithms/Common for default comparison logic (
Algorithms/Common/Comparers.cs) - Add unit tests in the test project (if present) to verify correctness on edge cases (empty, single, duplicates)
Add a New Graph Algorithm
🪤Traps & gotchas
.NET 10.0 SDK is a hard requirement—older .NET versions will not build this project. No configuration files needed; the project is self-contained. No environment variables or external service dependencies. One non-obvious detail: some sorting algorithms (BucketSorter, CountingSorter, PigeonHoleSorter, LSDRadixSorter) have constraints on input types (e.g., non-negative integers for counting sort)—check docstrings when using.
💡Concepts to learn
- Dijkstra's Algorithm — Single-source shortest path algorithm used in GPS, network routing, and game pathfinding—this repo's DijkstraShortestPaths.cs is a canonical reference implementation
- Breadth-First Search (BFS) vs. Depth-First Search (DFS) — Two fundamental graph traversal strategies with different properties (BFS finds shortest unweighted paths, DFS explores all reachable nodes)—this repo implements both as BreadthFirstSearcher.cs and DepthFirstSearcher.cs
- Topological Sorting — Dependency resolution and task scheduling algorithm critical in build systems and workflow engines—TopologicalSorter.cs applies DFS-based ordering to DAGs
- Edit Distance (Levenshtein Distance) — Dynamic programming algorithm for string similarity, used in spell checkers, DNA sequencing, and fuzzy matching—EditDistance.cs demonstrates classic DP optimization
- Sieve of Eratosthenes — Efficient prime number generation algorithm foundational to cryptography and number theory—SieveOfEratosthenes.cs and SieveOfAtkin.cs offer competing implementations
- Radix Sort (Counting-based sorting) — Linear-time sorting for integers and strings (LSDRadixSorter.cs, CountingSorter.cs)—outperforms comparison-based sorts when data type constraints apply
- Bipartite Graph Coloring — 2-coloring algorithm for detecting bipartite graphs; used in matching problems, scheduling, and circuit design—BipartiteColoring.cs applies BFS to color vertices
🔗Related repos
TheAlgorithms/C-Sharp— Community-driven mirror of DSA implementations in C#; wider coverage but less polished than this repodotnet/runtime— Official .NET runtime source; useful for understanding BCL data structures (List, Dictionary, SortedSet) that complement this librarygoogle/algorithms— Language-agnostic algorithm reference in Python/Java; useful for algorithm logic cross-reference when debugging C# implementationsmicrosoft/FASTER— Production-grade .NET data structures (log-structured key-value store) showing advanced patterns beyond classroom algorithms
🪄PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add comprehensive unit tests for DataStructures/Dictionaries hash table implementations
The repo has 4 hash table implementations (ChainedHashTable, CuckooHashTable, OpenAddressingHashTable, OpenScatterHashTable) but no visible test files in the structure. These are complex data structures prone to edge cases (collisions, load factors, resizing). Adding tests would improve reliability and serve as usage examples for contributors.
- [ ] Create DataStructures/Tests or DataStructures.Tests project (following .NET conventions)
- [ ] Add unit tests for ChainedHashTable.cs covering insertion, deletion, collisions, and load factor scenarios
- [ ] Add unit tests for CuckooHashTable.cs covering rehashing, eviction cycles, and failure cases
- [ ] Add unit tests for OpenAddressingHashTable.cs and OpenScatterHashTable.cs covering probing strategies
- [ ] Integrate tests into build_and_test.yml GitHub Action workflow
Add unit tests for Algorithms/Graphs graph traversal and pathfinding algorithms
The repo includes 10 graph algorithms (BFS, DFS, Dijkstra, BellmanFord, TopologicalSort, etc.) but no visible test suite. Graph algorithms are critical for correctness and have many edge cases (disconnected graphs, negative weights, cycles). Tests would validate implementations and provide usage documentation.
- [ ] Create Algorithms/Tests or Algorithms.Tests project
- [ ] Add unit tests for BreadthFirstSearcher.cs and DepthFirstSearcher.cs with various graph topologies
- [ ] Add unit tests for DijkstraShortestPaths.cs and BellmanFordShortestPaths.cs including negative weights and unreachable nodes
- [ ] Add unit tests for CyclesDetector.cs and BipartiteColoring.cs with edge cases
- [ ] Add tests for ConnectedComponents.cs and TopologicalSorter.cs
Add XML documentation and generate API documentation for public classes
The library has no visible XML doc comments (/// summaries) on public classes and methods. This is critical for a plug-and-play library where users discover classes via IntelliSense. Adding documentation enables IDE tooltips, improves discoverability, and enables automated doc generation.
- [ ] Add XML documentation (/// <summary>, /// <param>, /// <returns>) to all public classes in Algorithms/ and DataStructures/
- [ ] Start with high-value algorithms: Sorting (BubbleSorter.cs, QuickSorter.cs, MergeSorter.cs), Search (BinarySearcher.cs), and Graphs (DijkstraShortestPaths.cs)
- [ ] Ensure each public method documents parameters, return values, and complexity (time/space)
- [ ] Add a docs generation step to build_and_test.yml using DocFX or similar tool
- [ ] Include example usage in documentation for key classes
🌿Good first issues
- Add XML documentation comments to Algorithms/Numeric/ classes (BinomialCoefficients.cs, CatalanNumbers.cs, SieveOfAtkin.cs, SieveOfEratosthenes.cs)—they lack detailed parameter/return descriptions compared to sorting and graph classes.
- Implement and test a
LinearSearcher.csin Algorithms/Search/ as a companion to BinarySearcher.cs—currently the Search directory only has one algorithm. - Expand EditDistance.cs test coverage in Algorithms/Strings/—add edge cases (empty strings, single characters) and benchmark performance against EditDistanceCostsMap.cs to document when each is preferable.
⭐Top contributors
Click to expand
Top contributors
- @aalhour — 39 commits
- @nbitounis — 15 commits
- @kdimolikas — 10 commits
- @dependabot[bot] — 9 commits
- [@Ahmad Alhour](https://github.com/Ahmad Alhour) — 8 commits
📝Recent commits
Click to expand
Recent commits
c8ad538— docs: modernize README with collapsible sections and tables (Ahmad Alhour)c04c484— docs: add missing algorithms and data structures to README (Ahmad Alhour)9eddbdd— fix: resolve all xUnit analyzer warnings and implement ChainedHashTable enumerator (Ahmad Alhour)55c2243— Remove Travis CI badge from README (aalhour)2f60a0c— Fix SkipList sentinel node bugs (#138, #139) (Ahmad Alhour)6c55575— Fix OpenScatterHashTable, DLinkedList, BellmanFord, and SortedList bugs (Ahmad Alhour)4568efd— Fix critical bugs in SkipList and BinomialMinHeap, modernize tests (Ahmad Alhour)c88b530— Bump xunit.runner.visualstudio from 2.8.2 to 3.1.5 (#186) (dependabot[bot])a55e92b— Bump xunit from 2.9.2 to 2.9.3 (#185) (dependabot[bot])9b504f3— Bump Microsoft.NET.Test.Sdk from 17.12.0 to 18.0.1 (#184) (dependabot[bot])
🔒Security observations
This C# algorithms and data structures library demonstrates strong security posture. No critical or high-severity vulnerabilities were identified. The codebase contains no hardcoded secrets, injection risks, or infrastructure misconfigurations. The dependency file was not provided for analysis, so package-level vulnerabilities could not be assessed. The project uses modern GitHub Actions for CI/CD with appropriate build and test workflows. Only minor recommendation is to remove legacy Travis CI configuration. Overall, the project appears to be a well-maintained educational/reference library with minimal security concerns.
- Low · Travis CI Configuration File Present —
.travis.yml. The repository contains a .travis.yml file which is outdated CI/CD configuration. While not a direct security vulnerability, it indicates the project may have legacy configuration that should be reviewed and updated to use modern GitHub Actions (which is already present). Fix: Remove .travis.yml and ensure all CI/CD is configured through GitHub Actions workflows in .github/workflows/
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.