Domain: Engineering — Computer Science
Target concept: AVL Tree

Video generation prompt: A dynamically adjusting process of an unbalanced AVL tree (root 4 → left 2 → left 1, right 3) is demonstrated on a light background, with the unbalanced node highlighted in red, and the node positions update in real time as the tree is rotated.

Evaluation guide:
(i) Target concept: Visual demonstration of AVL tree self-balancing via a rotation triggered by a local height imbalance.
Minimum mechanism: Node positions must update in strict causal sequence (highlight → motion initiation → positional transition → final stable layout); red color must appear only on node 4 pre-rotation (the node whose left subtree [rooted at 2, height 1] is two levels taller than its empty right subtree [height −1], giving it a balance factor of 2) and vanish post-rotation; the rotation promotes node 2 to root, attaches node 1 as its left child and node 4 as its right child, and moves node 3 to become node 4's left child; final topology must satisfy the AVL balance definition (no node's left/right subtree heights differ by more than 1) while preserving BST ordering (1 < 2 < 3 < 4).
(ii)Storyline: Frame 0–2: Static display of the unbalanced tree (4→2→1, 4→2→3) with node 4 highlighted red; Frame 3–6: Smooth rotation animation: node 2 rises to become the new root, node 4 shifts down-right to become node 2's right child, node 3 shifts to attach under node 4 as its left child, node 1 remains node 2's left child; edges redraw in real time; red highlight fades out by Frame 5; Frame 7–10: Tree settles into its new layout (2 at root, 1 left, 4 right, 3 left-of-4), all labels legible, background unchanged, fixed front-facing orthographic view with no camera motion or zoom.

Manual:
Experimental Procedure
1. Display the initial unbalanced AVL tree: root node 4, left child 2, node 2's left child 1 and right child 3 — all on a light background.
2. Highlight node 4 in red to indicate imbalance (its left subtree, rooted at 2, is taller than its empty right subtree).
3. Animate a right rotation centered on node 4: node 2 moves upward to become the new root; node 1 stays as 2's left child; node 4 moves down to become 2's right child; node 3 moves to become 4's left child.
Observation of Experimental Phenomena
- Initially: node 4 is red; tree structure shows 4→2→1 and 4→2→3.
- During animation: node positions update continuously; edges reconnect dynamically.
- Finally: node 2 is root, 1 is left child, 4 is right child, 3 is left child of 4; no node is red; all subtrees satisfy AVL balance.
Summary of Experimental Principles
AVL trees maintain balance via rotations when a node's left and right subtree heights differ by more than 1. Here, node 4's left subtree (height 1, via node 2) is two levels taller than its empty right subtree (height −1), so a right rotation centered on node 4 restores |h_left − h_right| ≤ 1 for every node.

Prompt Grounding rubric:
level_1: No AVL tree structure appears; none of the nodes are labeled 1, 2, 3, or 4; there is no light background; no red highlight appears on any node; no rotation animation is shown; there is no visible before/after difference between an unbalanced and a balanced arrangement.
level_2: At least one labeled node (e.g., 4) appears on a light background, but the full initial tree (root 4, left child 2, with 2's left child 1 and right child 3) is not shown; no node is highlighted red; the nodes never visibly move or reposition.
level_3: The initial tree appears with the correct labels and links (root 4, its left child 2, and 2's left child 1 and right child 3) on a light background; a red highlight appears on one of the nodes; a rotation-like repositioning of nodes is shown; but either the red highlight sits on the wrong node (not node 4) or the resulting layout after the rotation is incomplete or mislabeled.
level_4: All of the prompt's elements are visually present and arranged correctly: the initial tree (4→2→1, 4→2→3), a red highlight on node 4, real-time repositioning of the nodes during the rotation, and a final tree with 2 at the root, 1 as its left child, 4 as its right child, and 3 as 4's left child; the light background is maintained throughout; no extra objects or labels appear. One minor visual flaw may remain, e.g., a label flickers briefly, one edge line is momentarily misaligned, or there is a brief opacity change during the motion.
level_5: All of the prompt's elements are present, correctly labeled, and unambiguous: the initial tree (root 4 → left 2 → left 1, right 3), the red highlight appearing only on node 4 (never on 1, 2, or 3), smooth continuous repositioning of the nodes during the rotation, and a final tree matching the AVL balance condition with 2 at the top, 1 to its left, 4 to its right, and 3 attached under 4's left; the light background stays even and unchanged, with no glitches, no label overlapping another element, and no extra nodes or edges.

Scientific and Causal Correctness rubric:
level_1: The tree does not follow binary-search-tree ordering (e.g., node 3 is placed to the left of node 2, or node 1 is placed to the right of node 4); no height imbalance is depicted at all; the rotation does not resolve any imbalance; the red highlight is placed on an already-balanced node, or no node is highlighted.
level_2: BST ordering is partly correct (e.g., a path visiting 1, 2, 3, 4 in increasing order exists), but at least one parent-child link violates BST ordering (e.g., 3 attached to the left of 2); the highlighted node is not node 4 (e.g., node 1, 2, or 3 is highlighted instead); the rotation leaves the tree more imbalanced than before, or breaks BST ordering.
level_3: BST ordering (1 < 2 < 3 < 4) is correct in both the initial and final trees; node 4 is correctly highlighted red as the unbalanced node, since its left subtree (rooted at 2, height 1) is two levels taller than its missing right subtree (height −1); after the rotation, every node in the final tree satisfies the AVL balance condition (left and right subtree heights differ by at most 1).
level_4: BST ordering holds in every frame; the red highlight appears only on node 4 and fades out during the rotation animation, no later than when the nodes finish updating to their new positions; node positions update continuously during the rotation, following the order highlight → rotation → new positions → balanced result; the final tree (2 root, 1 left, 4 right, 3 as 4's left child) satisfies the AVL balance condition for every node. One minor scientific flaw may remain, e.g., an edge is drawn with uneven thickness during the motion, or a label briefly renders as '04' instead of '4'.
level_5: BST ordering is correct in every frame with no exceptions; node 4 is highlighted red only during the unbalanced phase, with no other node ever shown in red; the animation matches a right rotation centered on node 4: node 2 rises to become the new root, node 1 stays as 2's left child, node 4 becomes 2's right child, and node 3 becomes 4's left child; the final heights are visibly consistent with AVL balance (e.g., nodes 1 and 3 sit at the same depth below 2 and 4); there is no BST violation, no leftover height imbalance, no highlight on the wrong node, and no step of the causal chain is skipped.

Spatiotemporal Consistency rubric:
level_1: Nodes jump between positions with no visible path in between (e.g., node 2 appears at the top-left in one frame and at the bottom-right in the next with nothing shown moving between them); edges disconnect and reconnect at arbitrary points; the background abruptly changes color; labels vanish or appear without any motion; several nodes move at once with no shared, coherent layout tying their motions together.
level_2: Node positions change without any visible interpolation (they simply jump); at least one edge breaks apart and reforms partway through the rotation; the background flickers or shifts tone; a label drifts away from the node it labels while that node is moving; nodes appear to rotate around different, inconsistent pivot points rather than one shared rotation.
level_3: All nodes move along continuous, plausible paths during the rotation; every edge stays connected to its two node centers throughout; the background stays static and unchanged; each label stays attached to its node as the node moves; the tree never breaks apart into floating, detached pieces. One minor spatiotemporal flaw may remain, e.g., one node's motion lags slightly behind the others, or one edge stretches noticeably before settling back to its normal length.
level_4: All motion is spatially coherent: nodes follow smooth, non-crossing paths from a fixed viewing angle; edges may bend slightly during the motion but never detach from their nodes; the background never changes; no node's label is hidden behind the node itself or another element; no node stretches or skews out of its normal shape. One small flaw may remain, e.g., one edge's endpoint looks briefly out of place before settling into its final position.
level_5: No spatiotemporal flaws remain: every node keeps the same size and shape throughout; all motion is smooth and continuous, with no jumps or stepwise repositioning; every edge stays taut and attached exactly to its two node centers at all times; the background is uniform and unchanging; the sharpness and framing look identical from the first frame to the last; there is no occlusion, no stretching, no jitter, and no drift from the fixed, front-facing viewing angle.