main.cpp
#include <iostream>
using namespace std;
template <typename Key, typename Value>
class BST{
private:
struct Node{
Key key;
Value value;
Node *left;
Node *right;
Node(Key key, Value value){
this->key = key;
this->value = value;
this->left = this->right = NULL;
}
};
Node *root;
int count;
public:
BST(){
root = NULL;
count = 0;
}
~BST(){
// TODO: ~BST()
}
int size(){
return count;
}
bool isEmpty(){
return count == 0;
}
};
int main() {
return 0;
}
本文详细介绍了一种通用的二叉搜索树(BST)模板实现,使用C++编写,适用于各种键值对类型。该实现包括了BST的基本操作,如插入、删除、查找等,并提供了一个简单的main函数作为演示。
418

被折叠的 条评论
为什么被折叠?



