[ BENCHMARKS / v5.0 / TASKS / 147_persistent_bst ]

Persistent (immutable) balanced BST in Python.

A persistent balanced binary search tree whose inserts copy only the root-to-leaf path, so every old version stays queryable.

Unit
147_persistent_bst
Category
Algorithms & DSTrees
Language
Python
Difficulty
Hard900 s wall clock (15 min)
Origin
From v4, kept as defined
Ranked rows passed
7/7single seed each

The prompt

The agent receives exactly this text as its task, verbatim. The harness adds its own system prompt and, in some campaign arms, guidance of its own; the harness chapter describes those. The task’s setup also writes the files its working directory starts with (a worked sample, a repository or a service, where the prompt names them); they are not reproduced here.

Prompt · 147_persistent_bst
Create /tmp/eval_pbst/pbst.py with three functions providing a persistent balanced BST (red-black or AVL): empty() returns an empty tree; insert(tree, key) returns a NEW tree containing key (the input tree must be unchanged — older versions remain queryable forever); contains(tree, key) returns True/False. The BST must remain balanced — operations must be O(log n). 10000 ascending inserts must complete in under 3 seconds. Crucially, insert must use path-copying (structural sharing): each new version copies only the O(log n) nodes on the root-to-leaf path and shares the rest with the previous version — so retaining ALL intermediate versions costs O(n log n) total nodes, NOT O(n^2). A full-tree copy on every insert is forbidden (it blows up memory). contains() on any historical version must work in O(log n). Treat keys as comparable integers.

What it tests and why it is in the suite

What it asks. A persistent balanced binary search tree whose inserts copy only the root-to-leaf path, so every old version stays queryable.

Why it is here. Kept from v4 as defined: the rework of the Algorithms & DS families did not clear review, so the v4 definition stands beside the new bigint and regex families.

In the suite README: evals/README.md:135 · evals/README.md:158

How it is graded

Graded by its v4 validator, sealed from the agent, after the agent stops. Two changes from v4: the prover can find a reference for it, and any wall-clock gate in its validator scales with the run’s timeout scale, as every v5 limit does. It is proven like every other unit (the reference passes; wrong and empty solutions and a leak probe fail), but in its v4 form it did not get the adversarial review the new families had.

Upstream: the prover’s controls · one unit’s life cycle · why v5 is built this way

How each ranked run did

One run per board row, the DGX Spark pair first, then the RTX 5090, then the gold standard. Each is a single seed: a pass or a fail on one unit is one draw, and a difference between two rows on one unit says little on its own. Claude Opus 5.5 is the unranked reference, in its own scaffold.

DGX Spark pair

One RTX 5090

Gold standard · unranked

  • Claude Opus 5.5Claude Code tools, no turn cap, 2× wallPassedPassed the validator.