BST is essentially a sorted BT in which for every node, the right child will stores a value that is greater than its parent node, and similarly the left contains a smaller value than its parent. The purpose for such kind of layout is to increase efficiency. For instance, from the labs, we are able to to search the BST very efficiently since we could avoid visiting unnecessary nodes.
This week's lab provides a great chance practicing recursion, we call the function on each level of node where we are tackling the same scenario: taking an advantage of the attribute of BST, we could decide which way do we keep recursing.
This week's lab provides a great chance practicing recursion, we call the function on each level of node where we are tackling the same scenario: taking an advantage of the attribute of BST, we could decide which way do we keep recursing.
No comments:
Post a Comment