depth(value)
Each call either finds the value (return 0), hits an empty subtree (return −1), or asks the correct child and adds one edge to whatever comes back.