在堆中是用数组实现的
MaxHeap(int capacity) {
data = new Item[capacity + 1];
count = 0;
this->capacity = capacity;
}在二分搜索树是用一个结构体的结构实现的
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;
}
};那既然两个都是二叉树 为什么在实现堆的时候 不用二分搜索树的结构体里的结构 而是用数组呢?