Vote count:
0
Node<E> search(Node<E> node, int data){
if(node == null){ return null }
if( node.value == data ){
return node
}else if(data > node.value){
return search(node.right,data)
}else{
return search(node.left,data)
}
}
This is what the search method looks like in my class of binary tree. Every element of the tree is a Node<E>
object, where Node<E>
is an inner class of BinarySearchTree
class. However, when I call the method, I get an exception. Here's how I am calling the method:
search(bt.root,14)
and the exception I get is this:
groovy.lang.MissingMethodException: No signature of method: BST.search() is applicable for argument types: (BinarySearchTree$Node, java.lang.Integer) values: [BinarySearchTree$Node@d851e, 14] Possible solutions: each(groovy.lang.Closure)
What is wrong here?
asked 36 secs ago
groovy.lang.MissingMethodException even when method is defined
Aucun commentaire:
Enregistrer un commentaire