Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ function lefties which returns the number of left child nodes in a node-based binary search tree containing positive integers. For example, given
Write a C++ function lefties which returns the number of left child nodes in a node-based binary search tree containing positive integers. For example, given the binary search tree below, your function should return 4 , because it contains 4 nodes which are left children - nodes 1,2,3, and 7 . Assume each node in your tree is implemented using the class BinaryNode, which implements the following binary node functions discussed in the videos and textbool (and only the following functions). +getItem(): integer +isLeaf (): boolean +getLeftChildPtr(): BinaryNode* +getRightChildPtr() : BinaryNode* // nodePtr: pointer to the root node of tree to check int lefties (BinaryNode* nodePtr)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started