Contains functions of the Quadtree class used for grading.
More...
Contains functions of the Quadtree class used for grading.
Given: prints the leaves of the Quadtree using a preorder traversal.
bool operator== |
( |
Quadtree const & |
other | ) |
const |
Given: compares the current Quadtree with the parameter Quadtree, and determines whether or not the two are the same.
- Parameters
-
other | Reference to a const Quadtree object, against which the current Quadtree will be compared |
- Returns
- True if the Quadtrees are deemed "equal", and false otherwise
- Note
- This method relies on the private helper method compareTrees()
void printTree |
( |
std::ostream & |
out, |
|
|
QuadtreeNode const * |
current, |
|
|
int |
level |
|
) |
| const |
|
private |
Given: prints the contents of the Quadtree using a preorder traversal.
- Parameters
-
current | Pointer to the root of the subQuadtree which we wish to print |
level | Current recursion depth; used for determining when to terminate recursion (see note below) |
bool compareTrees |
( |
QuadtreeNode const * |
firstPtr, |
|
|
QuadtreeNode const * |
secondPtr |
|
) |
| const |
|
private |
Given: compares the subQuadtree rooted at firstPtr with the subQuadtree rooted at secondPtr, and determines whether the two are the same.
- Parameters
-
firstPtr | Pointer to the root of a subtree of the "first" Quadtree under consideration |
secondPtr | Pointer to the root of a subtree of the "second" Quadtree under consideration |
- Returns
- True if the subQuadtrees are deemed "equal", and false otherwise