I am trying to answer some of the exam questions. But I've hit a huge snag(well at least for me it is). I am using the binarySearchTree header file & I want to write a code to find the maximum element in a tree. The problem is I need to traverse the tree from the root but there is no code to access the root node. Here is my code for the accessor function:
Yet I get these error messages:
error C:\unisa\mingw\bin\testProgBinarySearchTree.cpp:43 no matching function for call to `bSearchTreeType<int>::Findmax(nodeType<int>'
note C:\unisa\mingw\bin\binarySearchTree.h:211 candidates are: elemType bSearchTreeType<elemType>::Findmax(nodeType<elemType>*) [with elemType = int]
\unisa\mingw\bin\/binarySearchTree.h C:\unisa\mingw\bin\C In member function `nodeType<elemType> bSearchTreeType<elemType>::getRoot() [with elemType = int]':
43 C:\unisa\mingw\bin\testProgBinarySearchTree.cpp instantiated from here
error C:\unisa\mingw\bin\binarySearchTree.h:206 conversion from `nodeType<int>*' to non-scalar type `nodeType<int>' requested