Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
fp:lab05 [2022/03/31 08:53] pdmatei [5.2. Binary Search Trees] |
fp:lab05 [2022/03/31 08:53] (current) pdmatei |
||
---|---|---|---|
Line 63: | Line 63: | ||
**5.2.6.** Implement a method ''depth'' which returns the maximal depth of a BST. Hint: use the method: ''_.max(_)''. | **5.2.6.** Implement a method ''depth'' which returns the maximal depth of a BST. Hint: use the method: ''_.max(_)''. | ||
- | **5.2.8.** Implement a method ''minimum'' which returns the smallest integer from a BST. (If the tree is empty, we return -1). Hint: use the example above, to guide your implementation. | + | **(!) 5.2.8.** Implement a method ''minimum'' which returns the smallest integer from a BST. (If the tree is empty, we return -1). Hint: use the example above, to guide your implementation. |
**5.2.9.** Implement a similar method ''maximum''. | **5.2.9.** Implement a similar method ''maximum''. | ||
- | **5.2.10.** Implement a method ''successor(k)'' which returns **the smallest** integer from the BST, which is **larger** than ''k''. Use the following examples for your implementation: | + | **(!) 5.2.10.** Implement a method ''successor(k)'' which returns **the smallest** integer from the BST, which is **larger** than ''k''. Use the following examples for your implementation: |
<code> | <code> | ||
5 t.successor(2) = 5 | 5 t.successor(2) = 5 |