Question: Need help with my program it wants : Import bridges.connect.Bridges to allow you to create a Bridges object - Initialize a Bridges object with this
Need help with my program it wants :
Import bridges.connect.Bridges to allow you to create a Bridges object
- Initialize a Bridges object with this assignment number, your username, and your API key. (See the Bridges template on Moodle for details)
- The driver will remain essentially the same as the provided skeleton code
- Call Bridges setDataStructure method passing in the root of your tree and then call Bridges visualize method
This is my driver :
import bridges.connect.Bridges;
public class TreeDriver { private static final String API_Key = "805130419849"; private static final String USERNAME = "names"; Bridges bridge = new Bridges(0, API_Key, USERNAME);
public static void main(String[] args) {
BST
Integer[] values = {50, 25, 75, 50, 13, 17, 15, 37, 100, 22, 110, 60}; for(Integer v : values) { tree.insert(v, v); }
System.out.println(" Preorder:"); tree.preorder(); System.out.println(" Postorder:"); tree.postorder(); System.out.println(" Inorder:"); tree.inorder();
System.out.print(" count leaf nodes\t"); if( tree.countLeaves() == 5 ) { System.out.println(":)"); } else { System.out.println(":("); }
System.out.print("count internal nodes\t"); if( tree.countInternalNodes() == 7 ) { System.out.println(":)"); } else { System.out.println(":("); }
System.out.print("count two-child nodes\t"); if( tree.countTwoChildNodes() == 4 ) { System.out.println(":)"); } else { System.out.println(":("); }
System.out.print("max path length\t\t"); if( tree.getMaxPathLength() == 4 ) { System.out.println(":)"); } else { System.out.println(":("); }
} }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
