Mapa mental
Binary Search Trees 3
Conteúdo do mapa
Binary Search Trees 3
implementation contd.
- boolean contains(T element), boolean contains(T element, BTNode<T> current)
- recursion used : return contains(element, root);
- code in note->
- if (current ==null){return false;} // 3 conditions : if (element.compareTo(current.element) == 0){ // we can confirm that the element is in the tree so return true; } else if (element.compareTo(current.element) == -1){ // this means the element has lesser value than the is found at the current node // as such we would traverse the left subtree to look for the element return contains(element, current.left); } else { // this covers the final condition where element is of greater value than is in the current node return contains(element, current.right); }
- code in note->
- recursion used : return contains(element, root);
- boolean contains(T element), boolean contains(T element, BTNode<T> current)
Informações
- Descrição
- Mapa Mental sobre Binary Search Trees 3, criado por Eithne O'Sullivan em 04-03-2018.
- Criado por
- Eithne O'Sullivan
- Visualizações
- 1
- Avaliação