moving image to lecture 20
This commit is contained in:
@@ -86,7 +86,7 @@ point to the “in-order predecessor”.
|
||||
– Each node stores a parent pointer. Only the root node has a null parent pointer. [method 1]
|
||||
|
||||
|
||||
– Each iterator maintains a stack of pointers representing the path down the tree to the current node. [method 2]
|
||||
– Each iterator maintains a container of pointers representing the path down the tree to the current node. [method 2]
|
||||
|
||||
|
||||
- If we choose the parent pointer method, we’ll need to rewrite the insert and erase member functions to
|
||||
@@ -99,11 +99,12 @@ Be sure to draw a picture to help you understand!
|
||||

|
||||
|
||||
Exercise: [method 2] Write a fragment of code that given a tree iterator containing a pointer to the node and a
|
||||
stack of pointers representing path from root to node, finds the in-order successor (without using parent pointers).
|
||||
Either version can be extended to complete the implementation of increment/decrement for the ds_set tree iterators.
|
||||

|
||||
container of pointers representing path from root to node, finds the in-order successor (without using parent pointers).
|
||||
Either version can be extended to complete the implementation of increment/decrement for the ds_set tree iterators. (This method will be covered in the next lecture)
|
||||
|
||||
Exercise: What are the advantages & disadvantages of each method?
|
||||
<!--  -->
|
||||
|
||||
<!-- Exercise: What are the advantages & disadvantages of each method? -->
|
||||
|
||||
## 19.5 Limitations of Our BST Implementation
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
Reference in New Issue
Block a user