Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the definition of the function nodeCount that returns the number of nodes in the binary tree.Add this function to the class binaryTreeType and create
Write the definition of the function nodeCount that returns the number of nodes in the binary tree.Add this function to the class binaryTreeType and create a program to test this function.
main.cpp:
task:
Method nodeCount implemented
Build Status
Build Failed
Build Output
CMakeFiles/runTests.dirt-test-6a4406ad.cpp.o: In function `binaryTreeType::treeNodeCount() const': nt-test-6a4406ad.cpp:(.text._ZNK14binaryTreeTypeIiE13treeNodeCountEv[_ZNK14binaryTreeTypeIiE13treeNodeCountEv]+0x1f): undefined reference to `binaryTreeType ::nodeCount(nodeType *) const' collect2: error: ld returned 1 exit status make[2]: *** [runTests] Error 1 make[1]: *** [CMakeFiles/runTests.dir/all] Error 2 make: *** [all] Error 2
Test Contents
bSearchTreeTypeProgramming Exercise 19-1 Programming Exercise 19-1treeRoot; TEST(Tree,1) { ASSERT_EQ(treeRoot.treeNodeCount(), 0); treeRoot.insert(1); treeRoot.insert(434); treeRoot.insert(245); ASSERT_EQ(treeRoot.treeNodeCount(), 3); treeRoot.insert(543); treeRoot.insert(5563); treeRoot.insert(324532); ASSERT_EQ(treeRoot.treeNodeCount(), 6); treeRoot.insert(3245332); ASSERT_EQ(treeRoot.treeNodeCount(), 7); }
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