Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static List<Integer> getBaseNodesAux(TREE<Integer> baseTree, List<Integer> list, Node node, int nodeBaseLevel, int count) {
- if (node == null) {
- return null;
- }
- if (node.getLeft() == null && node.getRight() == null) {
- if (count == nodeBaseLevel - 1) {
- list.add((Integer) node.getElement());
- return list;
- } else {
- if (list.indexOf(node) == -1) {
- list.add((Integer) node.getElement());
- count++;
- getBaseNodesAux(baseTree, list, baseTree.root.getRight(), nodeBaseLevel, count);
- }
- }
- }
- if (node.getLeft() == null) {
- getBaseNodesAux(baseTree, list, node.getRight(), nodeBaseLevel, count);
- } else if (node.getRight() == null) {
- }
- if (element.compareTo(node.getElement()) < 0) {
- return misterio(element, node.getLeft());
- }
- return misterio(element, node.getRight());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement