Skip to main content\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 32.14 Exercises
These exercises use the same BSTNode structure as our basic binary search tree implementation. Here is the BSTNode definition:
Listing 32.14.1. BSTNode Declarationstruct BSTNode {
// Store a value and two child pointers
char value;
BSTNode* left;
BSTNode* right;
};
Checkpoint 32.14.1.
Implement
getHeight to return the height of the subtree rooted at the given node.
Checkpoint 32.14.2.
Implement
rotateRight to perform a right rotation on the subtree rooted at the given node. It should return the new root of the rotated subtree.
Checkpoint 32.14.3.
Implement
rotateLeft to perform a left rotation on the subtree rooted at the given node. It should return the new root of the rotated subtree.
You have attempted
of
activities on this page.