Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool isEqualTree(const BinarySearchTree<T>& other)
- {
- if (other.getCount() != getCount())
- {
- return false;
- }
- else
- {
- QueueList<Node<T>*> queue;
- queue.enQueue(root_);
- while (!queue.isEmpty())
- {
- Node<T>* temp = queue.deQueue();
- if (other.iterativeSearch(temp->key_) == false)
- {
- return false;
- }
- if (temp->left_ != nullptr)
- {
- queue.enQueue(temp->left_);
- }
- if (temp->right_ != nullptr)
- {
- queue.enQueue(temp->right_);
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement