mcpField
C
computer-science-algorithms

computer-science-algorithms

github.com/pproencaDevelopment218189 installsUpdated 11w ago
Repository

About computer-science-algorithms

A practical reference skill for developers choosing and implementing classical algorithms and data structures. It organizes guidance by impact, spanning everyday code review, problem solving, and techniques for large-scale data.

Key features

  1. 01Nine prioritized topic categories
  2. 02Algorithm and complexity selection
  3. 03Data structure guidance
  4. 04Graph, DP, and greedy patterns
  5. 05Streaming and probabilistic techniques

Use cases

  1. 01Selecting an algorithm for an input size
  2. 02Finding hidden quadratic operations in reviews
  3. 03Choosing graph or dynamic programming approaches
  4. 04Handling streaming data or distributed sharding

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pproenca/dot-skills --skill computer-science-algorithms

After installing, type/computer-science-algorithmsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
metadata.json
assets/templates/
_template.md
references/
_sections.md
comp-amortize-instead-of-worst-casing.md
comp-derive-recurrences-via-master-theorem.md
comp-pick-algorithm-class-from-input-bound.md
comp-prefer-iterative-builders-over-string-concatenation.md
comp-treat-space-complexity-as-first-class.md
comp-watch-for-quadratic-blowup-from-membership-in-list.md
divide-meet-in-the-middle-for-subset-problems.md
divide-merge-sort-pattern-for-counting-inversions.md
divide-quickselect-vs-quicksort-partitioning.md
divide-watch-recursion-depth-and-stack.md
dp-bitmask-for-small-set-states.md
dp-define-state-precisely.md
dp-knapsack-pattern.md
dp-memoize-overlapping-subproblems.md
dp-prove-optimal-substructure-before-coding.md
dp-tabulate-when-recursion-depth-or-order-matters.md
ds-balanced-bst-or-sorted-container-for-range-queries.md
ds-deque-for-both-end-operations.md
ds-fenwick-or-segment-tree-for-mutable-range-queries.md
ds-hash-map-for-keyed-lookup.md
ds-heap-for-top-k-and-priority-queues.md
ds-prefix-sums-for-repeated-range-sums.md
ds-set-for-uniqueness-and-membership.md
ds-union-find-for-dynamic-connectivity.md
graph-bfs-for-unweighted-shortest-path.md
graph-detect-cycles-during-dfs.md

Details

From the project README

Community Classical Computer Science Algorithms Best Practices

A practitioner-oriented reference for choosing and implementing classical algorithms and data structures correctly. Organized by execution-lifecycle impact: the earliest decisions (asymptotic class, data-structure choice) cascade through everything else, so the rules near the top of the table matter most.

Scope: the patterns that show up in everyday production code review, reasonable interview / contest problems, and the at-scale toolbox (sketches, streaming, distributed primitives) — not an exhaustive cover of CLRS. Topics intentionally outside the current version: network flow, modular arithmetic, Bellman-Ford and Floyd-Warshall as standalone rules, SCC (Tarjan/Kosaraju), computational geometry, FFT, Manacher / Z-function as standalone rules. They're flagged inline in the relevant rules.

Distilled from CLRS (Introduction to Algorithms, 4th ed.), Sedgewick & Wayne (Algorithms, 4th ed., Princeton), Skiena's Algorithm Design Manual, Laaksonen's Competitive Programmer's Handbook, cp-algorithms.com, and the USACO Guide.

When to Apply

Use these rules when:

  • Choosing an algorithm or data structure for a new problem ("what's the right way to do X?")
  • Reviewing code for hidden O(n²) blowup — repeated in-checks on lists, pop(0) on lists, string concatenation in loops, naive substring search
  • Picking a DP state or recurrence, before writing the memoization
  • Modeling a problem as a graph (BFS vs Dijkstra vs topological sort)
  • Refactoring brute force / naive solutions that work on toy inputs but time out at scale
  • Deciding whether greedy applies, or whether DP / branch-and-bound is required

Rule Categories By Priority

#CategoryPrefixImpactWhy it cascades
1Asymptotic Complexity & Algorithm Selectioncomp-CRITICALWrong O() class makes every other optimization irrelevant
2Data Structure Selectionds-CRITICALThe container determines which operations are cheap
3Sorting & Searchingsrch-HIGHFoundation for greedy, two-pointer, sweep-line, binary-search-on-the-answer
4Dynamic Programmingdp-HIGHExponential → polynomial transformations
5Graph Algorithmsgraph-HIGHNetworks, dependencies, routing, scheduling all reduce to graphs
6Divide & Conquer / Recursiondivide-MEDIUM-HIGHLogarithmic-factor speedups; stack-depth and recurrence traps
7Greedy Algorithmsgreedy-MEDIUMFast when correct, silently wrong when not
8String & Sequence Algorithmsstr-MEDIUMPattern matching, parsing, substring queries
9Scale & Probabilistic Algorithmsscale-MEDIUMSketches, streaming, distributed primitives — situational, decisive when they apply

Quick Reference

1. Asymptotic Complexity & Algorithm Selection (CRITICAL)
2. Data Structure Selection (CRITICAL)
3. Sorting & Searching (HIGH)
4. Dynamic Programming (HIGH)
5. Graph Algorithms (HIGH)
6. Divide & Conquer / Recursion (MEDIUM-HIGH)
7. Greedy Algorithms (MEDIUM)
8. String & Sequence Algorithms (MEDIUM)
9. Scale & Probabilistic Algorithms (MEDIUM)

The "unusual but valuable at scale" toolbox — sketches that trade tiny accuracy loss for orders-of-magnitude memory wins, streaming primitives for inputs that don't fit in RAM, and distributed structures that survive sharding changes.

How to Use

Start with the category that matches the question:

  • "What's the right algorithm for n = 10⁶?" → comp- (input-bound)
  • "I'm looking things up in a list inside a loop" → ds-hash-map-for-keyed-lookup or comp-watch-for-quadratic-blowup-from-membership-in-list
  • "My recursion is slow" → dp-memoize-overlapping-subproblems and comp-derive-recurrences-via-master-theorem
  • "Shortest path / connectivity / ordering tasks" → graph-
  • "Choose items to maximize value" → start with greedy-prove-exchange-argument-before-using; fall back to dp-knapsack-pattern
  • "Find / match strings" → str-
  • "Memory is the constraint, not time" / "Sample / count / deduplicate at scale" / "Sharding" → scale-

Code examples are in Python (most readable across audiences). The reasoning generalizes to any language — equivalent stdlib primitives are listed where they differ.

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information
AGENTS.mdAuto-built TOC navigation

Related Skills

  • complexity-optimizer — Static analysis that finds the patterns these rules diagnose

Comments

Markdown supported