adding ds set diagram

This commit is contained in:
Jidong Xiao
2023-10-26 10:51:59 -04:00
parent 15233cbb87
commit 9723e0b70f

View File

@@ -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
## Todays Lecture ## Todays 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.
![alt text](ds_set_diagram.png "ds set diagram")
## 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