ScapegoatTree extends AbstractSelfBalancingBinarySearchTree { protected Node rebuildTree(int size, Node scapegoat) { List<Node> nodes = new ArrayList<Node>(); Node currentNode = scapegoat; boolean done = false; Stack<Node> stack = new Stack<>(); while (!done) { if (currentNode != null) { stack.push(currentNode); currentNode = currentNode.left; } else { if (!stack.isEmpty()) { currentNode = stack.pop(); nodes.add(currentNode); currentNode = currentNode.right; } else { done = true; } } } return buildTree(nodes, 0, size - 1); } ScapegoatTree();  ScapegoatTree(double alpha); @Override Node insert(int element); @Override Node delete(int element);  }
@Test public void testRebuildTree() { }