Complete the code to check if a value should go to the left subtree in a BST insert function.
if value [1] node.value { // go left }
In a BST, values less than the current node go to the left subtree.
Complete the code to check if a value should go to the right subtree in a BST insert function.
if value [1] node.value { // go right }
In a BST, values greater than the current node go to the right subtree.
Fix the error in the BST search condition to correctly find a value.
if node.value [1] target { return true; }
To find a value, check if the current node's value equals the target.
Fill both blanks to complete the BST insert logic for left and right subtrees.
if value [1] node.value { insert_into(&mut node.left, value); } else if value [2] node.value { insert_into(&mut node.right, value); }
Values less than node go left; values greater go right in BST insert.
Fill the blank to create a HashMap that maps node values to their depth if depth is greater than 1.
let depth_map = nodes.iter().map(|node| (node.value, node.depth)).filter(|&(_, depth)| depth [1] 1).collect::<std::collections::HashMap<_, _>>();
We filter nodes with depth greater than 1 to include in the map.
