Domain: Engineering — Computer Science
Target concept: Build a Max Heap

Video generation prompt: Display a horizontally arranged array bar [5,2,3,4,1] on a white background, demonstrating the dynamic process of heap sort. Each step of the heap adjustment is marked with a red label. After sorting, the bars are arranged in ascending order, and the heap structure is simultaneously displayed on the right side.

Evaluation guide:
(i) Target concept: Visual demonstration of heap sort algorithm as a sequence of discrete, causally linked heap adjustments culminating in ascending order.
Minimum mechanism: Bars must represent array elements whose heights encode values; heap diagram must be a binary tree where node positions encode parent-child relationships and numeric labels reflect current values; red labels must exclusively annotate frames where a heap property restoration action occurs (swap or sift-down).
(ii)Storyline: Frame 0–1: Static display of [5,2,3,4,1] bars + empty/initial heap diagram on right, white background. Frame 2–3: Bottom-up heap construction: red label appears beside bar 5 as it rises to root position; heap diagram updates to show 5 at top with 4 and 3 as children. Frame 4–5: First extraction: bar 5 swaps with bar 1 (last unsorted); red label appears on root; heap diagram reflects new root (1) and updated children. Frame 6–7: Sift-down of 1: it moves down past 4 then 2; red label stays on moving node; heap diagram updates node positions/values in real time. Frame 8–9: Process repeats until bars settle into [1,2,3,4,5]; final heap diagram shows extracted nodes in reverse order. All events occur from fixed frontal viewpoint; no camera movement; no occlusion between left array and right heap.

Manual:
Experimental Procedure
1. Display white background.
2. Render horizontal bar array [5,2,3,4,1] left-aligned, with bar heights proportional to values.
3. Simultaneously render max-heap structure (tree diagram) on right side, initially empty or showing unsorted values.
4. Perform heap construction: adjust subtrees bottom-up; mark each adjustment with red label on affected root.
5. Perform heap sort: repeatedly extract max (swap root with last), then sift-down new root; mark each sift-down with red label on root node.
6. End with bars in ascending order [1,2,3,4,5] and heap diagram reflecting final extraction state.
Observation of Experimental Phenomena
- Initial bars show descending-height pattern except local inversions.
- Red labels appear only during heap adjustments (subtree root swaps/sifts), adjacent to moving bars or heap nodes.
- Heap diagram on right updates synchronously with bar motion, maintaining parent≥child relationships.
- Final bar array is strictly ascending with heights matching 1–5; heap diagram shows extracted nodes in order.
Summary of Experimental Principles
Heap sort relies on building a max-heap (parent ≥ children), then repeatedly extracting the maximum (root), swapping it to the sorted region, and restoring heap property via sift-down — ensuring O(n log n) time complexity and in-place sorting.

Prompt Grounding rubric:
level_1: No array bars are shown; or the bars are not arranged horizontally; or the background is not white; or no heap-tree panel appears on the right; or no red label ever appears.
level_2: Bars appear horizontally on a white background, but the starting values or order do not match [5,2,3,4,1] (wrong values, wrong order, a missing bar, or an extra bar); or the heap-tree panel is missing from the right side; or red labels appear only on the final sorted state or other non-adjustment frames rather than on heap-adjustment steps.
level_3: The starting bars read [5,2,3,4,1] left to right with heights matching those values, on a white background; the heap-tree panel is visible on the right; red labels appear during at least one heap-adjustment step (a swap or a sift-down); the bars end sorted in ascending order; however at least one red label sits on the wrong frame, or the heap-tree does not update in step with the bar motion, or one final bar's height does not match its value.
level_4: The starting array, background, and heap-tree panel all match the prompt exactly; the heap-tree panel updates correctly at every single adjustment step; red labels appear on every heap-adjustment frame and never elsewhere; the bars finish in strict ascending order with heights matching values 1 through 5; the left-array/right-heap-tree layout and fixed camera framing hold throughout.
level_5: Everything required at the 4-point level holds, and additionally every red label sits right next to the root of whichever subtree is being adjusted in the heap-tree; each bar's movement during a swap or sift matches the corresponding heap-tree change one-to-one; no frame shows a bar already moved while the heap-tree still shows the old arrangement, or a label appearing before its bar starts moving; nothing flickers, cuts away, or visibly re-renders.

Scientific and Causal Correctness rubric:
level_1: The bar motion does not resemble heap-sort logic at all: bars move in a random or arbitrary order; the final order is not ascending; the heap-tree never looks like a valid max-heap (a parent smaller than its child, no tree structure, or disconnected nodes).
level_2: Bars trend toward ascending order, but the max-heap construction or adjustment rules are broken: e.g., a root is swapped before the heap was ever properly built, a sift-down skips over a level it should not, or the bars finish in an order like [1,2,4,3,5] instead of fully ascending; the heap-tree shows two or more parent-smaller-than-child violations at once, persisting rather than being corrected.
level_3: A valid max-heap is built first (5 ends up at the root); the adjustment steps then follow extract-max, swap-root-with-last, sift-down in that order; but at least one sift-down promotes the smaller of two children instead of the larger, breaking the max-heap rule, or the final array is ascending while the heap-tree at some labeled step does not match what the step claims to be doing (e.g., a step labeled as a sift-down shows no node moving).
level_4: The full heap-sort logic holds visibly at every step: the starting array becomes a valid max-heap (every parent at least as large as its children); each extraction swaps the root with the last unsorted bar; each following sift-down moves the new root down along the larger child until the max-heap property is restored; the heap-tree mirrors the exact values and parent-child links of the current heap at every red-labeled frame; the final bar array is ascending and matches the order values were extracted in.
level_5: Everything required at the 4-point level holds, and additionally every heap-tree node's displayed value matches its corresponding bar's value at that exact instant; no frame ever shows a parent smaller than its child right after a labeled adjustment is supposed to be finished; the whole swap-violation-sift-restore cycle plays out step by step with no stage skipped or shown out of order.

Spatiotemporal Consistency rubric:
level_1: Bars teleport between positions; the heap-tree panel jumps, disappears, or reappears abruptly; red labels flash in and out with no motion leading up to them; the white background changes color or texture partway through; bars stretch, shear, or distort while moving.
level_2: Bars visibly stutter or drop frames as they move; the heap-tree shifts sideways or vertically between frames; red labels jump straight to a new spot instead of sliding or fading in; a bar's height changes abruptly mid-motion instead of smoothly interpolating; the camera view rotates or zooms unexpectedly.
level_3: The bars stay horizontal and aligned to the same baseline; the heap-tree panel stays fixed on the right without drifting; red labels stay anchored to whichever bar or node they are marking; nothing teleports or snap-jumps between positions; however at least one bar shows a noticeably uneven motion, an abrupt speed-up or slow-down partway through its move.
level_4: All motion is smooth and continuous: bars slide sideways only, with no unexpected vertical or depth movement; heap-tree nodes reposition smoothly as they update; red labels appear and slide in with consistent timing relative to the bar motion; nothing flickers, vanishes, or visibly re-renders; the bars keep their rectangular shape and proportions throughout.
level_5: Everything required at the 4-point level holds, and additionally every bar's speed of movement stays even with no sudden speed spikes; a swap, its matching heap-tree update, and its red label all happen within the same tight time window with no visible lag between them; there is no parallax shift or perspective warping anywhere in the clip.