Skip to content
Back to skills

Algorithm Data Structure Selection

ASecurity

`analysis-agent`/`task-agent`/`review-agent`: use when scale, access, complexity, memory, streaming, or skew drives an algorithm/data-structure choice; skip when no choice exists.

  • 7 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 8, 2026
businessgosecurityperformance

Works with

  • cursor

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 22, 2026

npx -y skills add machenjie/rd-skills --skill algorithm-data-structure-selection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Algorithm Data Structure Selection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Algorithm Data Structure Selection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/machenjie-algorithm-data-structure-selection/badge)](https://www.skillsdirectory.com/skills/machenjie-algorithm-data-structure-selection)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: algorithm-data-structure-selection
description: "`analysis-agent`/`task-agent`/`review-agent`: use when scale, access, complexity, memory, streaming, or skew drives an algorithm/data-structure choice; skip when no choice exists."
---

# algorithm-data-structure-selection

## Registry Trigger

**Use when**

- algorithm data structure Big O input size worst case memory budget map set list heap queue deque tree trie graph bloom filter LRU LFU
- interval tree segment tree top K dedupe grouping sorting streaming chunking pagination nested scan load all hot key skew

**Do not use when**

- no task-local algorithm data structure selection decision is required

## Skill Role

Choose algorithms and data structures from problem shape, scale distribution, memory budget, identity and ordering semantics, access pattern, and operational constraints.

## High-Value Rules

- Select algorithms from current input scale, distribution, access pattern, worst-case behavior, and failure consequence.
- Set an explicit memory bound for unbounded or oversized input.
- Use streaming, chunking, spill, or pagination when load-all processing exceeds that bound.
- Reject nested scans without a bounded cardinality or explicit complexity acceptance from the affected owner.
- Define memory and identity bounds for sorting, grouping, deduplication, top-K, graph, or probabilistic structures.
- Validate performance-sensitive choices with a representative test or benchmark and state where production scale remains unverified.
- Require a rejected simpler alternative and validation plan before adding indexes, caches, concurrency, dependencies, or probabilistic structures as a performance fix.

## Anti-Patterns

- Choosing a familiar structure without naming the optimized access pattern substitutes habit for evidence.
- Fully sorting Top-K when K is much smaller than N wastes avoidable work.
- Hash deduplication without identity and collision semantics can corrupt results.
- Grouping unbounded keys without spill or chunking makes memory follow uncontrolled cardinality.
- Pagination without stable ordering and cursor semantics loses or duplicates work.
- Average-case selection that ignores skew or adversarial input hides the dominating case.
- Graph traversal without cycle handling and a frontier bound can loop or exhaust memory.

## Stop Conditions

Return unresolved runtime reliability, capacity, recovery, or observability decisions involving SLO, batch-window, queue-lag, memory, or cost to Main for `reliability-observability-gate`. Route distributed processing to `bigdata-product-extension` and adversarial complexity to `security-privacy-gate`.

## Output Contract

- Algorithm Decision: problem shape, input scale, selected structure, time/space bounds, memory budget, streaming/chunking choice, alternatives, benchmarks, and scale risk

## Targeted References

| Path | Type | Load when | Do not load when | Required by | Required output |
|---|---|---|---|---|---|
| [benchmarks and patterns](references/benchmarks-and-patterns.md) | benchmark-pattern | Scale, skew, ordering, exactness, or memory changes the algorithm | The bounded operation has no material complexity tradeoff | task-agent, review-agent, analysis-agent | option-comparison, selected-approach |
| [checklist](references/checklist.md) | decision-checklist | Selection must cover worst-case growth, ordering, and oversize behavior | Input bounds and correctness semantics are already explicit | task-agent, review-agent, analysis-agent | checklist-result, residual-risk |
| [evidence patterns](references/evidence-patterns.md) | evidence-pattern | Performance claims require representative benchmarks, profiles, or query plans | No scale or hot-path claim needs empirical proof | task-agent, review-agent, analysis-agent | evidence-record, proof-limit, residual-risk |

Files in this skill

  • SKILL.md3.7 KB
  • references/benchmarks-and-patterns.md3.5 KB
  • references/checklist.md1 KB
  • references/evidence-patterns.md4.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…