Lab 2
Warning
To compile you should use a CMakeLists.txt. It takes some times to get use to it, but it makes the compilation much easier.
BST - Start
BST - Templates
Import the classes
Rectangle
andPosition
done in the previous lab.Create different rectangles (position and size), at least 10, and insert them in a BST.
Print the tree and ensure that the tree:
Contains all the rectangles
Have the rectangle ordered by the area
Try to remove some rectangle. Make sure that the tree is still ordered.
Modify the operators
operator<
,operator>
operator==
to compare the rectangle with the position.Redo the steps from 1 to 4. Make sure everything is working.
LeetCode
If you are done, you can start doing the following problems on LeetCode:
https://leetcode.com/problems/binary-tree-inorder-traversal/
https://leetcode.com/problems/construct-binary-search-tree-from-preorder-traversal/
ENSURE WE HAVE RECORDED YOUR COMPLETION. FAILURE TO DO SO WILL RESULT IN A GRADE OF 0!