This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class BTreePrinter { | |
public static <T extends Comparable<?>> void printNode(Node root) { | |
int maxLevel = BTreePrinter.maxLevel(root); | |
printNodeInternal(Collections.singletonList(root), 1, maxLevel); | |
} | |
private static <T extends Comparable<?>> void printNodeInternal(List<Node> nodes, int level, int maxLevel) { | |
if (nodes.isEmpty() || BTreePrinter.isAllElementsNull(nodes)) |