Skip to content
Skills Library
Programming · Learning & explanation

algorithms

/algorithms

Use when selecting algorithms, analyzing complexity, or reasoning about data structure choices. Covers Big-O notation, space vs time tradeoffs, amortized analysis, and algorithmic problem-solving strategy based on Knuth's "The Art of Computer Programming." USE FOR: algorithm selection, Big-O analysis, complexity comparison, choosing data structures, algorithmic problem-solving strategy DO NOT USE FOR: specific algorithm implementations (use sub-skills), system architecture (use dev/architecture), design patterns (use dev/design-patterns)

Licence
MIT
Last repository change
09.06.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
72
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 09.06.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when selecting algorithms, analyzing complexity, or reasoning about data structure choices. Covers Big-O notation, space vs time tradeoffs, amortized analysis, and algorithmic problem-solving strategy based on Knuth's "The Art of Computer Programming." USE FOR: algorithm selection, Big-O analysis, complexity comparison, choosing data structures, algorithmic problem-solving strategy DO NOT USE FOR: specific algorithm implementations (use sub-skills), system architecture (use dev/architecture), design patterns (use dev/design-patterns)

Triggers from the description

The Art of Computer Programming.
Original author description

Use when selecting algorithms, analyzing complexity, or reasoning about data structure choices. Covers Big-O notation, space vs time tradeoffs, amortized analysis, and algorithmic problem-solving strategy based on Knuth's "The Art of Computer Programming." USE FOR: algorithm selection, Big-O analysis, complexity comparison, choosing data structures, algorithmic problem-solving strategy DO NOT USE FOR: specific algorithm implementations (use sub-skills), system architecture (use dev/architecture), design patterns (use dev/design-patterns)

How it works

  1. Overview
  2. Canonical Reference
  3. Big-O Notation
  4. Space vs Time Tradeoffs
  5. Amortized Analysis
  6. Choosing Algorithms by Problem Type
  7. Algorithm Analysis Checklist
  8. Best Practices
Original SKILL.md headings · 103 lines, 912 words
SKILL.md preview
---
name: algorithms
description: |
    Use when selecting algorithms, analyzing complexity, or reasoning about data structure choices. Covers Big-O notation, space vs time tradeoffs, amortized analysis, and algorithmic problem-solving strategy based on Knuth's "The Art of Computer Programming."
    USE FOR: algorithm selection, Big-O analysis, complexity comparison, choosing data structures, algorithmic problem-solving strategy
    DO NOT USE FOR: specific algorithm implementations (use sub-skills), system architecture (use dev/architecture), design patterns (use dev/design-patterns)
license: MIT
metadata:
  displayName: "Algorithms & Data Structures"
  author: "Tyler-R-Kendrick"
compatibility: claude, copilot, cursor
references:
  - title: "The Art of Computer Programming — Donald Knuth"
    url: "https://www-cs-faculty.stanford.edu/~knuth/taocp.html"
  - title: "Algorithm — Wikipedia"
    url: "https://en.wikipedia.org/wiki/Algorithm"
---

# Algorithms & Data Structures

## Overview
This skill covers the foundational principles of algorithmic thinking, drawn primarily from Donald Knuth's *The Art of Computer Programming* (TAOCP). It provides guidance on analyzing algorithm efficiency, understanding complexity classes, and choosing the right algorithmic approach for a given problem.

## Canonical Reference

| Volume | Title | Covers |
|--------|-------|--------|
| TAOCP Vol. 1 | *Fundamental Algorithms* | Data structures, mathematical foundations, information structures |
| TAOCP Vol. 2 | *Seminumerical Algorithms* | Random numbers, arithmetic, floating-point |
| TAOCP Vol. 3 | *Sorting and Searching* | Sorting, searching, comparison of methods |
| TAOCP Vol. 4A | *Combinatorial Algorithms, Part 1* | Combinatorial generation, backtracking, constraint satisfaction |
| TAOCP Vol. 4B | *Combinatorial Algorithms, Part 2* | Satisfiability, graph algorithms |

## Big-O Notation

Big-O describes the upper bound of an algorithm's growth rate as input size increases. It characterizes the worst-case behavior and allows comparison between algorithms independent of hardware.

### Common Complexity Classes

| Notation | Name | Example |
|----------|------|---------|
| O(1) | Constant | Hash table lookup, array index access |
| O(log n) | Logarithmic | Binary search, balanced BST lookup |
| O(n) | Linear | Linear search, single array traversal |
| O(n log n) | Linearithmic | Mergesort, Heapsort, efficient comparison sorts |
| O(n^2) | Quadratic | Bubble sort, insertion sort (worst case), nested loops |
| O(2^n) | Exponential | Recursive Fibonacci (naive), subset enumeration |

### Growth Rate Comparison

```
n        O(1)   O(log n)  O(n)     O(n log n)  O(n^2)      O(2^n)
1        1      0         1        0           1           2
10       1      3.3       10       33          100         1,024
100      1      6.6       100      664         10,000      ~1.27 x 10^30
1,000    1      10        1,000    10,000      1,000,000   ~1.07 x 10^301
10,000   1      13.3      10,000   133,000     100,000,000 (infeasible)
```

## Space vs Time Tradeoffs

Every algorithm makes a tradeoff between how much memory it uses and how fast it runs. Key principles:

- **Caching / Memoization**: Use extra space to store computed results and avoid redundant work (trades space for time).
- **In-place algorithms**: Minimize space usage at the cost of potentially more complex logic or slower execution (trades time for space).
- **Lookup tables**: Precompute results and store them for O(1) access (trades space for time).
- **Compression**: Reduce space at the cost of encoding/decoding time (trades time for space).

| Strategy | Space | Time | Example |
|----------|-------|------|---------|
| Memoized recursion | O(n) extra | Avoids recomputation | DP Fibonacci |
| In-place sort | O(1) extra | May be slower | Heapsort vs Mergesort |
| Hash table | O(n) extra | O(1) average lookup | Two-sum problem |
| Bit manipulation | O(1) extra | Constant factor overhead | Flags, compact sets |

## Amortized Analysis

Amortized analysis averages the cost of operations over a sequence, even when individual operations may be expensive. It provides a tighter bound than worst-case analysis for data structures that occasionally restructure.

- **Aggregate method**: Total cost of n operations divided by n.
- **Accounting method**: Assign different charges to different operations; overcharges on cheap operations "pay" for expensive ones.
- **Potential method**: Define a potential function on the data structure state; amortized cost = actual cost + change in potential.

**Example**: Dynamic array (ArrayList) doubling. Individual insertions are O(1) amortized even though resizing copies all elements, because resizing happens infrequently (the cost of copying is spread across the insertions that preceded it).

## Choosing Algorithms by Problem Type

| Problem Type | Recommended Approach | Sub-Skill |
|--------------|---------------------|-----------|
| Ordering elements | Comparison sort (Quicksort, Mergesort) or linear sort (Radix) | sorting-searching |
| Finding elements | Binary search, hash-based lookup | sorting-searching |
| Storing/retrieving structured data | Choose appropriate data structure by access pattern | data-structures |
| Shortest path / connectivity | Graph algorithms (BFS, DFS, Dijkstra) | graph-algorithms |
| Optimization with overlapping subproblems | Dynamic programming | dynamic-programming |
| Enumerating configurations / constraint solving | Backtracking, branch and bound | combinatorial |
| String matching | KMP, Rabin-Karp, suffix structures | sorting-searching |
| Scheduling / ordering dependencies | Topological sort | graph-algorithms |
| Minimum spanning tree | Prim's, Kruskal's | graph-algorithms |
| Subset/permutation generation | Combinatorial generation | combinatorial |

## Algorithm Analysis Checklist

When evaluating or selecting an algorithm:

1. **Identify the problem class** -- Is it a searching, sorting, graph, optimization, or enumeration problem?
2. **Determine input constraints** -- What is the expected input size? Are there special properties (sorted, sparse, bounded range)?
3. **Analyze time complexity** -- What is the worst-case, average-case, and best-case behavior?
4. **Analyze space complexity** -- How much auxiliary memory is required?
5. **Consider stability and determinism** -- Does order preservation matter? Is randomness acceptable?
6. **Evaluate practical constants** -- Two O(n log n) algorithms may differ significantly in constant factors and cache behavior.
7. **Benchmark with real data** -- Asymptotic analysis is a starting point; real-world performance depends on data distribution and hardware.

## Best Practices

- Start with the simplest correct algorithm, then optimize if profiling shows a bottleneck.
- Know the standard library -- most languages provide well-optimized sorting, searching, and data structure implementations.
- Prefer algorithms with good average-case behavior for general use; consider worst-case guarantees for safety-critical systems.
- Understand amortized costs before concluding that an operation is "slow" based on a single invocation.
- Reference Knuth's TAOCP for rigorous analysis and historical context on any fundamental algorithm.
Files in this package (72)
  • AGENTS.md 6 KB
  • README.md 2 KB
  • SKILL.md 7 KB
  • metadata.json 1 KB
  • combinatorial/AGENTS.md 10 KB
  • combinatorial/README.md 1 KB
  • combinatorial/SKILL.md 11 KB
  • combinatorial/metadata.json 1 KB
  • combinatorial/rules/_sections.md 2 KB
  • combinatorial/rules/_template.md 1 KB
  • combinatorial/rules/combinatorial-always-add-pruning-to-backtracking-even-simple.md 1 KB
  • combinatorial/rules/combinatorial-choose-variable-and-value-ordering-heuristics-carefully.md 1 KB
  • combinatorial/rules/combinatorial-consider-whether-the-problem-has-symmetries-that-can-be.md 1 KB
  • combinatorial/rules/combinatorial-for-optimization-problems-consider-branch-and-bound-before.md 1 KB
  • combinatorial/rules/combinatorial-for-problems-with-overlapping-subproblems-e.md 1 KB
  • combinatorial/rules/combinatorial-reference-knuth-s-taocp-vol.md 1 KB
  • combinatorial/rules/combinatorial-use-constraint-propagation-forward-checking-arc.md 1 KB
  • data-structures/AGENTS.md 9 KB
  • data-structures/README.md 1 KB
  • data-structures/SKILL.md 10 KB
  • data-structures/metadata.json 1 KB
  • data-structures/rules/_sections.md 1 KB
  • data-structures/rules/_template.md 1 KB
  • data-structures/rules/data-structures-choose-the-data-structure-based-on-the-dominant-operation.md 1 KB
  • data-structures/rules/data-structures-consider-cache-locality.md 1 KB
  • data-structures/rules/data-structures-for-concurrent-access-consider-concurrent-variants.md 1 KB
  • data-structures/rules/data-structures-prefer-standard-library-implementations-they-are.md 1 KB
  • data-structures/rules/data-structures-reference-knuth-s-taocp-vol.md 1 KB
  • data-structures/rules/data-structures-remember-that-theoretical-complexity-is-not-the-full-story.md 1 KB
  • dynamic-programming/AGENTS.md 9 KB
  • dynamic-programming/README.md 1 KB
  • dynamic-programming/SKILL.md 10 KB
  • dynamic-programming/metadata.json 1 KB
  • dynamic-programming/rules/_sections.md 2 KB
  • dynamic-programming/rules/_template.md 1 KB
  • dynamic-programming/rules/dynamic-programming-always-verify-optimal-substructure-before-applying-dp.md 1 KB
  • dynamic-programming/rules/dynamic-programming-consider-whether-the-problem-admits-a-greedy-solution.md 1 KB
  • dynamic-programming/rules/dynamic-programming-define-your-state-precisely-and-minimally-extra-state.md 1 KB
  • dynamic-programming/rules/dynamic-programming-for-interview-competition-settings-practice-identifying.md 1 KB
  • dynamic-programming/rules/dynamic-programming-reference-knuth-s-taocp-for-mathematical-rigor-on-sequence.md 1 KB
  • dynamic-programming/rules/dynamic-programming-validate-your-recurrence-with-small-examples-before-coding.md 1 KB
  • graph-algorithms/AGENTS.md 9 KB
  • graph-algorithms/README.md 1 KB
  • graph-algorithms/SKILL.md 10 KB
  • graph-algorithms/metadata.json 1 KB
  • graph-algorithms/rules/_sections.md 2 KB
  • graph-algorithms/rules/_template.md 1 KB
  • graph-algorithms/rules/graph-algorithms-always-choose-the-simplest-algorithm-that-handles-your.md 1 KB
  • graph-algorithms/rules/graph-algorithms-consider-whether-the-graph-is-a-dag-many-problems.md 1 KB
  • graph-algorithms/rules/graph-algorithms-for-a-invest-time-in-designing-a-good-heuristic-the.md 1 KB
  • graph-algorithms/rules/graph-algorithms-for-sparse-graphs-adjacency-list-representation-is-almost.md 1 KB
  • graph-algorithms/rules/graph-algorithms-reference-knuth-s-taocp-for-rigorous-mathematical-analysis.md 1 KB
  • graph-algorithms/rules/graph-algorithms-when-implementing-kruskal-s-always-use-union-find-with.md 1 KB
  • rules/_sections.md 1 KB
  • rules/_template.md 1 KB
  • rules/algorithms-know-the-standard-library-most-languages-provide.md 1 KB
  • rules/algorithms-prefer-algorithms-with-good-average-case-behavior-for.md 1 KB
  • rules/algorithms-reference-knuth-s-taocp-for-rigorous-analysis-and.md 1 KB
  • rules/algorithms-start-with-the-simplest-correct-algorithm-then-optimize-if.md 1 KB
  • rules/algorithms-understand-amortized-costs-before-concluding-that-an.md 1 KB
  • sorting-searching/AGENTS.md 9 KB
  • sorting-searching/README.md 1 KB
  • sorting-searching/SKILL.md 10 KB
  • sorting-searching/metadata.json 1 KB
  • sorting-searching/rules/_sections.md 1 KB
  • sorting-searching/rules/_template.md 1 KB
  • sorting-searching/rules/sorting-searching-consider-the-two-pointers-technique-before-reaching-for.md 1 KB
  • sorting-searching/rules/sorting-searching-for-searching-in-a-sorted-collection-always-prefer-binary.md 1 KB
  • sorting-searching/rules/sorting-searching-reference-knuth-s-taocp-vol.md 1 KB
  • sorting-searching/rules/sorting-searching-the-sliding-window-technique-converts-many-o-n-2.md 1 KB
  • sorting-searching/rules/sorting-searching-use-your-language-s-built-in-sort-typically-timsort-or.md 1 KB
  • sorting-searching/rules/sorting-searching-when-data-has-bounded-integer-keys-consider-counting-or.md 1 KB

Versions

RepositoryScoreLicence
This page · Tyler-R-Kendrick/agent-skills100MIT
jewdah-afk/aaa-kit100MIT

Database snapshot: 13.11.2026 · package version e4227e009ffa (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90role-algorithms:algorithm-design
    Designs algorithms with formal analysis — Big-O/Theta/Omega, amortized analysis, recurrence relations (Master theorem), correctness proofs (loop invariants, induction, reduction), and paradigm selection (greedy, divide-and-conquer, dynamic programming, backtracking). Use when…
  • 100algorithm-selection-and-complexity
    Use when choosing, reviewing, or explaining an algorithm under explicit correctness, time, space, input-scale, or maintainability constraints; use system-architecture-design for service boundaries and language skills for implementation syntax.
  • 100code-complexity-analysis
    Analyzes source code to assess performance using algorithmic complexity (time and space) plus a machine-aware cost model (memory hierarchy, branches, ILP, SIMD, parallelism). Identifies bottlenecks and recommends algorithmic, data-structure, and constant-factor optimizations.…
  • 100computer-science-algorithms
    Choosing or implementing an algorithm or data structure — asymptotic complexity, data-structure selection, sorting & searching, dynamic programming, graph algorithms, divide & conquer, greedy algorithms, string/sequence algorithms, and the at-scale toolbox (Bloom filters,…
  • 100time-complexity
    Estimate Big-O time complexity of code via static analysis (tree-sitter MCP). Use when: complexity, big-o, performance, hotspot, time complexity, analyze complexity.
  • 90data-structures
    Use when selecting, implementing, or reasoning about data structures. Covers arrays, linked lists, stacks, queues, hash tables, trees (BST, AVL, Red-Black, B-Tree, Trie), heaps, and graphs (adjacency list, adjacency matrix). Based on Knuth's TAOCP Vol. 1. USE FOR: choosing data…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.