MCPcopy Create free account
hub / github.com/careercup/ctci / printAsTree

Method printAsTree

java/Chapter 17/Question17_13/QuestionC.java:6–14  ·  view source on GitHub ↗
(BiNode root, String spaces)

Source from the content-addressed store, hash-verified

4public class QuestionC {
5
6 public static void printAsTree(BiNode root, String spaces) {
7 if (root == null) {
8 System.out.println(spaces + "- null");
9 return;
10 }
11 System.out.println(spaces + "- " + root.data);
12 printAsTree(root.node1, spaces + " ");
13 printAsTree(root.node2, spaces + " ");
14 }
15
16 public static BiNode createTree() {
17 BiNode[] nodes = new BiNode[7];

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected