template <class T>
bool BST<T>::search(const T& x, int& len) const
{
return search(BT<T>::root, x);
}
template <class T>
bool BST<T>::search(struct Node<T>*& root, const T& x)
{
if (root == NULL)
return false;
else
{
if (root->data == x)
return true;
else if(root->data < x)
search(root->left, x);
else
search(root->right, x);
}
}
Yani bu T düğümle benim BST sınıf için benim arama fonksiyonudur. x veri ağacına içinde, len o varsa eşleştirme düğümü ile gelip seyahat etmek zorunda düğümler miktarı adildir için Aratılan. Henüz, sadece aşamalı benim atama geliştiriyorum olduğunu implented değil. Bunu yaparak diyorum:
if(t.search(v[1], len) == true)
cout << endl << true;
v ı karşılaştırmak için oluşturmak zorunda sadece bir vektör olduğunu ve bu yüzden bu sadece bir int ile tedarik edilir. Ben alıyorum hatası:
BST.h: In member function âbool BST<T>::search(const T&, int&) const [with T = int]â:
prog5.cc:24: instantiated from here
BST.h:78: error: no matching function for call to âBST<int>::search(Node<int>* const&, const int&) constâ
BST.h:76: note: candidates are: bool BST<T>::search(const T&, int&) const [with T = int]
BST.h:83: note: bool BST<T>::search(Node<T>*&, const T&) [with T = int]
Bu yüzden ben yanlış yapıyorum ya da nerede yanlış yapıyorum emin değilim.













