mercredi 11 décembre 2019

Recursive inorder binary tree traversal cannot access info in pointers

I am trying to write a function to traverse every node in my binary search tree. When I do comparisons the pointers have no difficulty accessing data. However, when I try to recursively call the function while sending the next pointer in line, it says that the data in the pointer cannot be reached.

void binarySearchTree:: fullTermSearchPrivate(node *ptr, string searchTerm)
{
    if(ptr == NULL) return;

    fullTermSearch(searchTerm, ptr->left);       //Ptr cannont access data here
    if(ptr->aData.getName() == searchTerm || ptr->aData.getYear() == searchTerm || ptr->aData.getFilm() == searchTerm )
{
    printActornode(ptr);
}
fullTermSearch(searchTerm, ptr->right);       // Ptr cannot access data here
}

Aucun commentaire:

Enregistrer un commentaire