Step 3 of 4
In-Order Traversal & Extremes
You start from the build so far — your own work where you have written it, the reference build where you have not. Either way this step stands on its own.
In-order traversal of a BST (Left $\to$ Root $\to$ Right) always yields elements in strictly ascending sorted order.
inOrder(): Returns an array/list of all values in ascending order.min(): Follows left pointers to find the smallest value (ornull/Noneif empty).max(): Follows right pointers to find the largest value (ornull/Noneif empty).
Your build
Running is free — Submit is what records the step. Or press ⌘↩
Tests
1 case| call | type | expected | result |
|---|---|---|---|
| runOps([["insert",20],["insert",10],["insert",30],["insert",5],["insert",15],["inOrder"],["min"],["max"]]) | produces sorted in-order traversal and finds min/max | [null,null,null,null,null,[5,10,15,20,30],5,30] | — |
Hints
Stuck? Hints open one at a time, each giving a little more away.
2 hints left