avodado
avodado docs
Blocks reference

Algorithms

Field contracts and worked examples for the 4 algorithms blocks.

Field contracts and worked examples for the algorithms blocks — converted at build time from the repo's authoring-skill reference. Every example body is YAML; in a real doc the fence language is the block type (for example sequence … ). Schemas are strict — unknown fields are rejected. See the field contract for the at-a-glance shape of all 77 blocks, or the block catalog for live previews.

Algorithms & data structures

Purpose-built for algorithm walkthroughs and CS explainers — one step per block (freeze a moment, don't animate). All four share the same tone enum: active (navy — the element under examination) · visited (light blue — already processed) · target (green — the goal) · muted (gray — out of play). For graph algorithms (BFS / DFS / Dijkstra), use graph with node state + edge weight instead.

array — array cells for algorithm walkthroughs

```arrayeditable · live
renderedavo renders this
SECTION 01 · Array

Binary search for 27 — step 2

ARRAY

mid lands on 19, so the search space halves to the right.

Array0317212319427541lomidhisearch space
Valid — passes avo check

A row of square cells. value is a string — quote numbers (value: "19"). Indices render above each cell (showIndex, default true); a pointer label ("i", "lo", "mid") renders below its cell with a ▲ tick; window draws a navy-dashed outline around a 0-based inclusive index range (out-of-bounds values clamp). Use array for binary search, two pointers, and sliding windows; use table for genuinely tabular data.

linkedlist — pointer-chain diagram

```linkedlisteditable · live
renderedavo renders this
SECTION 01 · Linked list

Reversing a list — step 2

LIST
Linked list9471prevcurrnext
Valid — passes avo check

Boxed nodes (a value cell + a pointer-dot cell) joined by arrows. kind: doubly adds a second, lower back-arrow per link; nullEnd (default true) terminates the chain in a ∅ ground symbol. A node label ("head", "curr") renders above its node with a ▼ tick. Use linkedlist for pointer manipulation (reversal, insertion, fast/slow); use flow for control flow.

bintree — binary tree

```bintreeeditable · live
renderedavo renders this
SECTION 01 · Binary tree

BST search for 27

TREE
Binary tree198312740
Valid — passes avo check

Nodes reference their parent by id and must set side: left | right when they do — a parent without a side is a schema error, and so is placing two children on one side. Parentless nodes are roots; multiple roots lay out side by side (handy for showing rotations). A parent centres over its children and single-child nodes offset toward their side, so unbalanced chains slant instead of stacking. Tint the chain down to a target to show a search path. Use bintree for BSTs, heaps, and traversals; use tree for file hierarchies (and tree with variant: issue for issue breakdowns).

hashmap — buckets + chained entries

```hashmapeditable · live
renderedavo renders this
SECTION 01 · Hash map

Chained hash table

HASH

hash(key) % 8 — plum and grape collide in bucket 2.

Hash map0apple: 312plum: 9grape: 1345fig: 767
Valid — passes avo check

A vertical column of bucket slots (indices 0..buckets-1); each bucket's entries chain rightward as rounded key: value pills joined by arrows — collision chains read left → right in entry order. Empty buckets show a dim "—". Entries whose bucket falls outside 0..buckets-1 are skipped, not clamped — they simply don't render, so fix the index. Rendering caps at 12 buckets with a "+N more" note; keep the count small enough to read. Use hashmap for hashing / collision walkthroughs; use table for plain key-value listings.