adding ds set diagram
This commit is contained in:
@@ -3,13 +3,16 @@
|
|||||||
## Review from Lecture 16
|
## Review from Lecture 16
|
||||||
|
|
||||||
- STL set container class (like STL map, but without the pairs!)
|
- STL set container class (like STL map, but without the pairs!)
|
||||||
|
- set iterators, insert, erase, find
|
||||||
|
|
||||||
## Today’s Lecture
|
## Today’s Lecture
|
||||||
|
|
||||||
|
- Binary trees, binary search trees
|
||||||
- Implementation of ds_set class using binary search trees
|
- Implementation of ds_set class using binary search trees
|
||||||
- In-order, pre-order, and post-order traversal
|
- In-order, pre-order, and post-order traversal
|
||||||
|
|
||||||
## 17.1 Definition: Binary Trees
|
## 17.1 Definition: Binary Trees
|
||||||
|
|
||||||
- A binary tree (strictly speaking, a “rooted binary
|
- A binary tree (strictly speaking, a “rooted binary
|
||||||
tree”) is either empty or is a node that has
|
tree”) is either empty or is a node that has
|
||||||
pointers to two binary trees.
|
pointers to two binary trees.
|
||||||
@@ -100,8 +103,7 @@ integer. Hint: think recursively!
|
|||||||
|
|
||||||
## 17.7 ds_set and Binary Search Tree Implementation
|
## 17.7 ds_set and Binary Search Tree Implementation
|
||||||
|
|
||||||
- A partial implementation of a set using a binary search tree is in the code attached. We will continue to study
|
- A partial implementation of a set using a binary search tree is [here](ds_set_starter.h). We will continue to study this implementation in Lab 10 & the next lecture.
|
||||||
this implementation in Lab 10 & the next lecture.
|
|
||||||
- The increment and decrement operations for iterators have been omitted from this implementation. Next week
|
- The increment and decrement operations for iterators have been omitted from this implementation. Next week
|
||||||
in lecture we will discuss a couple strategies for adding these operations.
|
in lecture we will discuss a couple strategies for adding these operations.
|
||||||
- We will use this as the basis both for understanding an initial selection of tree algorithms and for thinking
|
- We will use this as the basis both for understanding an initial selection of tree algorithms and for thinking
|
||||||
@@ -121,6 +123,8 @@ node) that does all of the work.
|
|||||||
- Because the class stores and manages dynamically allocated memory, a copy constructor, operator=, and
|
- Because the class stores and manages dynamically allocated memory, a copy constructor, operator=, and
|
||||||
destructor must be provided.
|
destructor must be provided.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## 17.9 Exercises
|
## 17.9 Exercises
|
||||||
|
|
||||||
1. Provide the implementation of the member function ds_set<T>::begin. This is essentially the problem of
|
1. Provide the implementation of the member function ds_set<T>::begin. This is essentially the problem of
|
||||||
|
|||||||
Reference in New Issue
Block a user