Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int prof(E no, List<E> path){
- Node node = root;
- int prof = 0;
- boolean found = false;
- List<Node> path = new ArrayList<>();
- while(!found){
- if(node.getElement().equals(no)){
- path.add(no);
- found = true;
- }else{
- Node right = root.getLeft();
- Node left = root.getRight();
- if(no > node){
- prof += 2;
- path.add(right);
- node = right;
- }else{
- prof += 2;
- path.add(left);
- node = left;
- }
- }
- }
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement