diff --git a/TinySTL/AVLTree.h b/TinySTL/AVLTree.h index f3ce4de..bce8948 100644 --- a/TinySTL/AVLTree.h +++ b/TinySTL/AVLTree.h @@ -45,7 +45,7 @@ namespace TinySTL{ void insert(const T& val); template void insert(Iterator first, Iterator last); - void erase(const T& val);//todo + void erase(const T& val); size_t height()const{ return getHeight(root_); } size_t size()const{ return size_; } diff --git a/TinySTL/BinarySearchTree.h b/TinySTL/BinarySearchTree.h index debd66e..300f5f3 100644 --- a/TinySTL/BinarySearchTree.h +++ b/TinySTL/BinarySearchTree.h @@ -87,7 +87,7 @@ namespace TinySTL{ };//end of bst class template size_t binary_search_tree::height_aux(node *p)const{ - TinySTL::queue q, level; + TinySTL::queue q/*存放下一层的node*/, level/*存放当前层的node*/; size_t nlevel = 0; if (p != 0){ level.push(p); @@ -95,7 +95,7 @@ namespace TinySTL{ while (!(q.empty() && level.empty())){ if (level.empty()){ ++nlevel; - while (!q.empty()){ + while (!q.empty()){//当前层为空,将下一层的node全部转移至当前层 level.push(q.front()); q.pop(); }