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

  1. Download the header file of the class BinarySearchTree header

  2. Implement each method of the class in a file BinarySearchTree.cpp.

  3. Download the test file of the class main.

  4. Test your class. Make sure everything works.

BST - Templates

  1. Import the classes Rectangle and Position done in the previous lab.

  2. Create different rectangles (position and size), at least 10, and insert them in a BST.

  3. Print the tree and ensure that the tree:

    • Contains all the rectangles

    • Have the rectangle ordered by the area

  4. Try to remove some rectangle. Make sure that the tree is still ordered.

  5. Modify the operators operator<, operator> operator== to compare the rectangle with the position.

  6. 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:

ENSURE WE HAVE RECORDED YOUR COMPLETION. FAILURE TO DO SO WILL RESULT IN A GRADE OF 0!