data-structures-for-disjoint-sets

data-structures-for-disjoint-sets is a skill for Claude Code, Codex from Arcadi4/nerdy. It costs 54 tokens per session (3,170 once invoked), scanned A, original, MIT.

A guide to disjoint sets, also called union-find: groups of items that can be joined and checked for membership in the same group.

In plain words
What is it for?
Use it for connected components, dynamic connectivity, union and find operations, path compression, and related offline algorithms.
Why use it?
It keeps explanations accurate about how groups are represented, how representatives are chosen, and how operation speed is analyzed.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for connected components, dynamic connectivity, union and find operations, path compression, and related offline algorithms.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/arcadi4/nerdy/data-structures-for-disjoint-sets
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Arcadi4/nerdy --skill data-structures-for-disjoint-sets
Clone the repo
git clone --depth 1 https://github.com/Arcadi4/nerdy

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for data-structures-for-disjoint-sets

README.md
[![agentmods](https://agentmods.dev/badge/skills/arcadi4/nerdy/data-structures-for-disjoint-sets.svg)](https://agentmods.dev/skills/arcadi4/nerdy/data-structures-for-disjoint-sets)
Your own site
<a href="https://agentmods.dev/skills/arcadi4/nerdy/data-structures-for-disjoint-sets"><img src="https://agentmods.dev/badge/skills/arcadi4/nerdy/data-structures-for-disjoint-sets.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,170 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00054 $0.03170
Opus 5 $0.00027 $0.01585
Sonnet 5 $0.00011 $0.00634
Haiku 4.5 $0.00005 $0.00317

Measured 7d ago against content hash e6bdef8e22db, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

data-structures-for-disjoint-sets scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

clrs/data-structures-for-disjoint-sets/SKILL.md · 286 lines

How it starts

The opening of the file, as written. The whole thing — 286 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Data Structures for Disjoint Sets

Overview

Use this skill to keep disjoint-set answers honest about representatives, handles, sequence bounds, and offline metadata. The key behavior change is to separate the abstract partition contract from representation choices: linked lists, forests, rank, path compression, and application-specific metadata all have different invariants.

Shared CLRS Conventions

Follow the parent clrs skill for mathematical formatting and proof tone. In this chapter skill, operation names such as MAKE-SET, UNION, and FIND-SET may appear in code spans, but all mathematical bounds and symbolic definitions must be displayed in LaTeX blocks, not placed in prose, headings, inline code, or Markdown tables.

When to Use

Use this skill for:

  • Union-find or disjoint-set APIs, including makeSet, find, union, and sameComponent.
  • Dynamic connectivity where edges only accumulate and components are queried.
  • Explaining why a representative is arbitrary unless the API explicitly stores separate canonical metadata.
  • Comparing linked-list and forest representations.
  • Analyzing weighted union, union by rank, path compression, and inverse-Ackermann amortized bounds.
  • Offline algorithms that use disjoint sets as a bookkeeping layer: connected components, offline minimum, depth determination with pseudodistances, and Tarjan offline lowest common ancestors.

Do not use it for fully dynamic graph connectivity with deletions, online minimum extraction, or online LCA queries unless the answer explicitly says the chapter technique is not sufficient by itself.

Quick Reference

Topic Use it to decide Required contract
Abstract disjoint sets Whether the problem only needs partition membership FIND-SET returns a stable representative only while the set is unchanged
Connected components Whether edges are only added before queries Initialize every vertex, union endpoints, compare representatives
Linked-list sets Whether constant-time find is worth expensive unions Every element has a back-pointer to the set object
Weighted union on lists Whether sequence cost matters more than one union Append the shorter list to the longer list and update moved back-pointers
Disjoint-set forests Whether tree roots can represent sets Parent pointers form rooted trees; roots point to themselves
Union by rank Whether tree growth is controlled without path compression Rank is history metadata and only increases on equal-rank root links
Path compression Whether repeated finds should flatten search paths FIND-SET rewrites parents on the path to the root
Offline minimum Whether the full operation sequence is known Process keys in increasing order through insertion-block sets
Offline LCA Whether all tree queries are known before DFS Answer a pair only when the other endpoint is black

Read the full file on GitHub · 286 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 286 lines · 54 tokens per session scan A e6bdef8e22db

Subscribe to this mod's changes

data-structures-for-disjoint-sets is a skill published in the GitHub repository Arcadi4/nerdy (7 stars, last pushed 4mo ago), licensed MIT. It adds 54 tokens to every session and 3,170 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

ljg-word

Deep-dive English word mastery tool. Deconstructs a single English word into core semantics and epiphany. Use when user asks to explain/master a specific English word.

lijigang/ljg-skills · 39 tokens

coding

A coding guide for writing and running Python programs in a sandbox. It requires scripts to be small and reproducible, with their actual output or errors reported.

bojieli/ai-agent-book · 18 tokens

golang-stay-updated

Golang ecosystem watch list — official sources (go.dev/blog, pkg.go.dev, tour.golang.org, golang-nuts), newsletters (Golang Weekly, Awesome Go Newsletter), communities (r/golang, gophers.slack.com, Go Forum, go.dev/wiki), blogs (Dave Cheney, Ardan Labs, Rob Pike), YouTube channels (Gopher Academy, GopherCon EU/UK)…

samber/cc-skills-golang · 181 tokens

rust-learner

Learn Rust language features and crate updates. Use when user asks about Rust version changelog, what's new in Rust, crate updates, Cargo.toml dependencies, tokio/serde/axum features, or any Rust ecosystem questions.

actionbook/actionbook · 51 tokens

course

A Python helper that displays tutorials, group information, source-code links, and other resources for the python-office library in a terminal.

CoderWanFeng/python-office · 38 tokens

llvm-learning

Comprehensive learning resources and tutorials for LLVM, Clang, and compiler development. Use this skill when helping users learn LLVM internals, find educational resources, or understand compiler concepts.

gmh5225/awesome-llvm-security · 39 tokens