agentleFS
grndlvlgrndlvl/software-patterns/.claude/skills/clrs-algorithms/SKILL.md

clrs-algorithms

Skill17 starsChanged 9 months agoMITView on GitHub

Data structures and algorithms reference based on CLRS. Use this skill when implementing, discussing, or choosing data structures or algorithms. Auto-activates for algorithm selection, complexity analysis, and performance optimization. Comprehensive coverage of fundamental and advanced data structures with pseudocode examples.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask about or need to implement a data structure

    line 13
  2. Distinctive:

    Choosing a structure: Start with the decision guides

    line 97
  3. Distinctive:

    Learning a structure: Read the full documentation with examples

    line 98
  4. Distinctive:

    Quick reminder: Use the tables above for at-a-glance reference

    line 99
  5. Distinctive:

    Implementation: Follow the pseudocode, adapt to your language

    line 100

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

CLRS Data Structures & Algorithms Reference

A comprehensive reference for data structures and algorithms based on "Introduction to Algorithms" (CLRS). This skill provides language-agnostic guidance with pseudocode examples that can be translated to any programming language.

When This Skill Activates

This skill automatically activates when you:

  • Ask about or need to implement a data structure
  • Need to choose between data structures for a problem
  • Discuss time/space complexity trade-offs
  • Need algorithm implementations (sorting, searching, graph algorithms)
  • Mention specific structures: B-tree, heap, hash table, graph, etc.

Quick Data Structure Reference

Linear Structures

StructureAccessSearchInsertDeleteUse When
ArrayO(1)O(n)O(n)O(n)Known size, index access
Dynamic ArrayO(1)O(n)O(1)*O(n)Unknown size, frequent append
Linked ListO(n)O(n)O(1)O(1)Frequent insert/delete
StackO(1)O(n)O(1)O(1)LIFO needed
QueueO(1)O(n)O(1)O(1)FIFO needed
DequeO(1)O(n)O(1)O(1)Both ends access

Trees

StructureSearchInsertDeleteUse When
Binary Search TreeO(log n)*O(log n)*O(log n)*Ordered data, frequent search
AVL TreeO(log n)O(log n)O(log n)Guaranteed balance needed
Red-Black TreeO(log n)O(log n)O(log n)Frequent inserts/deletes
B-TreeO(log n)O(log n)O(log n)Disk-based storage
TrieO(m)O(m)O(m)String/prefix operations
HeapO(1)/O(n)O(log n)O(log n)Priority queue needed
Splay TreeO(log n)*O(log n)*O(log n)*Self-adjusting, temporal locality
TreapO(log n)*O(log n)*O(log n)*Randomized balance, split/merge
Interval TreeO(log n)O(log n)O(log n)Interval overlap queries
Order-Statistic TreeO(log n)O(log n)O(log n)Rank/select queries
K-D TreeO(log n)*O(log n)*O(log n)*Multi-dimensional spatial data

Hash-Based

StructureSearchInsertDeleteUse When
Hash TableO(1)*O(1)*O(1)*Fast key-value lookup
Hash SetO(1)*O(1)*O(1)*Unique membership testing
Bloom FilterO(k)O(k)N/AProbabilistic membership

Graphs

StructureSpaceAdd EdgeQuery EdgeUse When
Adjacency ListO(V+E)O(1)O(degree)Sparse graphs
Adjacency MatrixO(V²)O(1)O(1)Dense graphs

Graph Algorithms

AlgorithmTimeUse When
Network FlowO(VE²)Max flow, bipartite matching, min cut
Strongly Connected ComponentsO(V+E)Find SCCs, 2-SAT, dependency analysis

Strings

StructureBuildSearchUse When
Suffix ArrayO(n log n)O(m log n)Space-efficient string matching
Suffix TreeO(n)O(m)Fast pattern matching, LCS
String AlgorithmsO(m)O(n)KMP, Rabin-Karp, Boyer-Moore, Aho-Corasick

Advanced

StructureUse When
Skip ListProbabilistic balanced list
Disjoint SetUnion-find operations
Segment TreeRange queries with updates
Fenwick TreePrefix sums with updates
Fibonacci HeapDijkstra, Prim with O(1) decrease-key
Binomial HeapMergeable priority queue
van Emde Boas TreeInteger keys with O(log log u) operations

Algorithms

AlgorithmUse When
Sorting AlgorithmsQuickSort, MergeSort, HeapSort, RadixSort, and more

* = amortized or average case

Decision Guides

  • Which Data Structure Should I Use? - Decision guide by use case
  • Complexity Cheat Sheet - Quick reference for Big-O

How to Use This Reference

  1. Choosing a structure: Start with the decision guides
  2. Learning a structure: Read the full documentation with examples
  3. Quick reminder: Use the tables above for at-a-glance reference
  4. Implementation: Follow the pseudocode, adapt to your language

Language Translation Notes

The pseudocode in this reference uses these conventions:

  • class for type definitions
  • function for methods/functions
  • -> for method calls on objects
  • // for comments
  • Type hints shown as name: Type

Translate to your language:

  • PHP: class, function, ->, //, type hints in docblocks or PHP 8+
  • JavaScript/TypeScript: class, function/arrow, ., //, TS types
  • Python: class, def, ., #, type hints
  • Java/C#: Direct mapping with new, generics

Based on concepts from "Introduction to Algorithms" by Cormen, Leiserson, Rivest, and Stein (CLRS), MIT Press.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.