Binary search

Drag along the weights

A laboratory balance behind a case of sixteen brass weights in order. Each try weighs the sample against the middle weight left standing, and the half that cannot hold the answer sinks into its seats.

Prompt

/anatomy explain binary search, interactive

Install

npm install anatomy-figures

In your code

page.tsx
import { BinarySearch } from "anatomy-figures";

<BinarySearch theme="light" />

Or load this figure on its own, so the others never download:

page.tsx
import BinarySearch from "anatomy-figures/binary-search";

Theme it

Five themes (dark, light, paper, blueprint, sepia), or your own colours through tokens. Every token.

page.tsx
<BinarySearch
  theme="light"
  tokens={{
    "--anatomy-card": "#ffffff",
    "--anatomy-lit": "#e5484d",
  }}
/>

Without React

index.html
import { define } from "anatomy-figures/element/binary-search";

define();

<anatomy-binary-search theme="light"></anatomy-binary-search>
The Creation of Adam, Michelangelo, c. 1512