Suppose IntBSTNode is a BSTnode with integer data. Write a new static method to meet the following specifications:
Public void increase (IntBSTNode root)
//precondition: root is the root reference of a binary search tree.
//postcondition: every node of the tree has had its data increased by one.
Me: 2) Using BSTNode class, write a new static method to meet the follow specifications:
Public static int manyNodes (BSTNode root)
//precondition: Root is the root reference of a binary search tree
//Postcondition: The return value is the nunber of nodes in the tree/ //notes: The empty tree has 0 nodes, and a tree with just a root has 1 node.
Me: 3) Using BSTNode class, write a new static method to meet the follow specifications:
Public static int manyNodes (BSTNode root)
//precondition: Root is the root reference of a binary search tree
//Postcondition: the return value is the depth of the binary tree.
Please post the solutions, these are study material for an exam tomorrow and I completely forgot I had these.
If you can explain that would be great too :p
