BTree implements Serializable { public int findParent(int nodeIndex) { return findParent(nodeIndex, size); } BTree(int size); T get(int index); void set(int index, T value); int getSize(); int findParent(int nodeIndex); Children findChildren(int nodeIndex); boolean isRoot(int nodeIndex); T getRoot();  }
@Test public void findParent() { BTree<Integer> tree = new BTree<>(13); Assert.assertEquals(tree.findParent(0), 13); Assert.assertEquals(tree.findParent(12), 23); Assert.assertEquals(tree.findParent(13), 19); Assert.assertEquals(tree.findParent(16), 20); Assert.assertEquals(tree.findParent(17), 21); Assert.assertEquals(tree.findParent(19), 22); Assert.assertEquals(tree.findParent(22), 24); Assert.assertEquals(tree.findParent(23), 24); Assert.assertEquals(tree.findParent(24), 24); BTree<Integer> tree2 = new BTree<>(12); Assert.assertEquals(tree2.findParent(0), 12); Assert.assertEquals(tree2.findParent(7), 15); Assert.assertEquals(tree2.findParent(8), 16); Assert.assertEquals(tree2.findParent(11), 17); Assert.assertEquals(tree2.findParent(12), 18); Assert.assertEquals(tree2.findParent(16), 20); Assert.assertEquals(tree2.findParent(17), 20); Assert.assertEquals(tree2.findParent(19), 21); Assert.assertEquals(tree2.findParent(20), 22); BTree<Integer> tree3 = new BTree<>(11); System.out.println(tree3.findParent(10)); System.out.println(tree3.findParent(14)); }