1: // Created by Frank M. Carrano and Timothy M. Henry. 2: // Copyright (c) 2017 Pearson Education, Hoboken, New Jersey. 4: template<class ItemType> 5: void BinaryNodeTree<ItemType>:: 6: destroyTree(std::shared_ptr<BinaryNode<ItemType>> subTreePtr) 7: { 8: if (subTreePtr != nullptr) 9: { 10: destroyTree(subTreePtr–>getLeftChildPtr()); 11: destroyTree(subTreePtr–>getRightChildPtr()); 12: subTreePtr.reset(); // Decrement reference count to node 13: } // end if 14: } // end destroyTree