binary-search-trees

binary-search-trees is a skill for Claude Code, Codex from Arcadi4/nerdy. It costs 42 tokens per session (3,327 once invoked), scanned A, original, MIT.

A guide to binary search trees, which store items in sorted order so they can be searched and traversed. It also covers balanced trees such as red-black trees and the pointer changes used to maintain them.

In plain words
What is it for?
Use it for ordered sets and dictionaries, sorted traversal, range scans, predecessor and successor queries, and tree operations.
Why use it?
It helps you understand how tree height and ordering rules affect search, insertion, deletion, and ordered-container choices.

Skill for Claude CodeCodex

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

Good fit Use it for ordered sets and dictionaries, sorted traversal, range scans, predecessor…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/arcadi4/nerdy/binary-search-trees
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 binary-search-trees
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 binary-search-trees

README.md
[![agentmods](https://agentmods.dev/badge/skills/arcadi4/nerdy/binary-search-trees.svg)](https://agentmods.dev/skills/arcadi4/nerdy/binary-search-trees)
Your own site
<a href="https://agentmods.dev/skills/arcadi4/nerdy/binary-search-trees"><img src="https://agentmods.dev/badge/skills/arcadi4/nerdy/binary-search-trees.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,327 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.00042 $0.03327
Opus 5 $0.00021 $0.01664
Sonnet 5 $0.00008 $0.00665
Haiku 4.5 $0.00004 $0.00333

Measured 6d ago against content hash 8ce270d24d6d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

binary-search-trees 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 6d 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/binary-search-trees/SKILL.md · 261 lines

How it starts

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

Binary Search Trees

Overview

Binary search trees are not mainly a recommendation to hand-roll pointer trees. They teach an ordered-set mindset: keep ordering separate from representation, treat height as the operational risk, make local navigation decisions from invariants, and use small pointer rewrites to preserve object identity while changing structure.

When applying this chapter in industrial contexts, answer both questions:

  1. What invariant makes the operation correct?
  2. What data-shape, identity, duplicate, cache, or library constraint makes the textbook implementation inappropriate or appropriate?

Shared CLRS Conventions

Also follow the parent clrs skill for mathematical formatting, theorem preconditions, proof tone, and chapter-skill routing. Put formal bounds in display LaTeX blocks, not inline prose.

When to Use

Use this skill for:

  • Ordered dictionaries, ordered sets, range scans, predecessor and successor queries, nearest-neighbor-by-key questions, and sorted traversal.
  • Basic BST operations: TREE-SEARCH, TREE-MINIMUM, TREE-MAXIMUM, TREE-SUCCESSOR, TREE-PREDECESSOR, TREE-INSERT, TREE-DELETE, and TRANSPLANT.
  • Red-black-tree invariants, rotations, insertion fixup, deletion fixup, and height guarantees.
  • Questions asking whether a plain BST, balanced BST, B-tree, skip list, hash table, array, or standard library container is the right production choice.
  • Debugging pointer-tree code where the ordering relation is correct but parent links, external handles, rotations, or color/black-height repair are suspicious.

Do not use this skill as the primary guide for:

  • Unordered exact lookup with no rank, range, predecessor, or sorted-order need; prefer hash-table reasoning.
  • External-memory indexes, storage engines, or database indexes where B-trees or LSM-style structures dominate.
  • Full sorting problems unless the point is to contrast inorder traversal with sorting or range enumeration.
  • Implementing a production ordered map when the language standard library already provides one and no special invariant is required.

Read the full file on GitHub · 261 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. 6d ago First seen · 261 lines · 42 tokens per session scan A 8ce270d24d6d

Subscribe to this mod's changes

binary-search-trees is a skill published in the GitHub repository Arcadi4/nerdy (7 stars, last pushed 4mo ago), licensed MIT. It adds 42 tokens to every session and 3,327 once invoked, about $0.0002 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