1. Requirements
Basic JavaScript, React state, arrays, recursion, and SVG rendering.
Data structures
This demo starts with a static array. Each added value is deduplicated, sorted, and used to create a balanced binary search tree. Searching compares the target value against each node and moves left or right until the value is found or the path ends.
Basic JavaScript, React state, arrays, recursion, and SVG rendering.
Pick the middle value as the root, recursively build the left half, and recursively build the right half.
Compare the selected number with the current node, record the path, then recurse left or right based on the comparison.