Download - Discussion Section Assignment 7
![Page 2: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/2.jpg)
s-value: The distance to the nearest leaf The right descendant of each node has the
lower s-value In min (max) leftist tree the root contains
the minimum (maximum) item To delete a minimum item (in min leftist
tree), we remove the root and the left and right sub-trees are then merged (melded)
2
![Page 3: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/3.jpg)
3
![Page 4: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/4.jpg)
4
![Page 5: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/5.jpg)
5
![Page 6: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/6.jpg)
6
![Page 7: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/7.jpg)
7
![Page 8: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/8.jpg)
8
![Page 9: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/9.jpg)
9
![Page 10: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/10.jpg)
10
![Page 11: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/11.jpg)
11
![Page 12: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/12.jpg)
12
![Page 13: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/13.jpg)
13
![Page 14: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/14.jpg)
Two ways:1. Merge each node one at a time into one HBLT
O(nlogn)2. Use a queue to store each node and resulting
tree. The first two items in the queue are removed, merged, and placed back into the queue. O(n)
14
![Page 15: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/15.jpg)
In a min (max) winner tree, the player with the smaller (larger) value wins.
In a loser tree, in each internal node, the loser of the match played at that node is recorded.◦ Reduces the work needed to determine the
players of each match after replacing the winner.
15
![Page 16: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/16.jpg)
16
![Page 17: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/17.jpg)
17
![Page 18: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/18.jpg)
18
![Page 19: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/19.jpg)
Properties:◦ Every element has a key (or value), and no
elements have the same key.◦ The keys in the left subtree of the root are smaller
than the key in the root.◦ The keys in the right subtree of the root are larger
than the key in the root.◦ The left and right subtrees of the root are also
binary search trees.
19
![Page 20: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/20.jpg)
Insert the keys 9, 2, 7, 11, 16, 15, 1 into the tree in this order.
20
![Page 21: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/21.jpg)
Insert the keys 9, 2, 7, 11, 16, 15, 1 into the tree in this order.
21
![Page 22: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/22.jpg)
Insert the keys 9, 2, 7, 11, 16, 15, 1 into the tree in this order.
22
![Page 23: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/23.jpg)
Insert the keys 9, 2, 7, 11, 16, 15, 1 into the tree in this order.
23
![Page 24: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/24.jpg)
Insert the keys 9, 2, 7, 11, 16, 15, 1 into the tree in this order.
24
![Page 25: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/25.jpg)
Insert the keys 9, 2, 7, 11, 16, 15, 1 into the tree in this order.
25
![Page 26: Discussion Section Assignment 7](https://reader035.vdocuments.us/reader035/viewer/2022062410/56815570550346895dc33c94/html5/thumbnails/26.jpg)
Insert the keys 9, 2, 7, 11, 16, 15, 1 into the tree in this order.
26