Slug: tree-bst-01 · Paired reading: Chapter 19
Prompt
Implement fn insert(root: &mut Tree, val: i32) and fn contains(root: &Tree, val: i32) -> bool
with a moving &mut / & cursor. Duplicates go right.
Contract
- Duplicates insert to the right
containson empty tree isfalse- Cursor uses moving
&mut/&— noRc