reset password
Author Message
astrong2
Posts: 25
Posted 14:12 Mar 18, 2018 |

How would I go about testing the methods for our Lab? I've created a Runner class but can't get it to call the methods.

jungsoolim
Posts: 38
Posted 16:23 Mar 18, 2018 |

Hi Alex,

First, you will need to write a code to output the elements by tree traversal. 

Second, instantiate your binary tree (i.e. BST<Integer> tree = new BST<>()) and insert few sample data for testing (i.e. tree.insert(7)).

Then, call your tree traversal methods (i.e. in-order, pre-order, post-order etc) to output the elements.

 

AlbertR
Posts: 5
Posted 16:27 Mar 18, 2018 |

I didn't use runner, called everything in a main from the BST the prof gave us

jungsoolim
Posts: 38
Posted 16:41 Mar 18, 2018 |

Please do not include main method in BST class. No data structure should have main method.

The data structure must be instantiated in Test or Runner class.

Please remove main method in any data structure.

Thanks!

astrong2
Posts: 25
Posted 16:44 Mar 18, 2018 |

Thank you! My main question was what to put as the argument when calling the method. For example:

tree.recursiveInOrder(   ?);

astrong2
Posts: 25
Posted 16:52 Mar 18, 2018 |

Nevermind I figured it out. Thanks for the help!