Skip to content

Commit cb870be

Browse files
committed
删除了b+树的调试输出
1 parent 632a0a9 commit cb870be

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

ext/bplustree.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,12 @@ void NonLeaf<T>::RedistributeLeaf(int i) {
319319
left_len = new_len - this->child[i]->key.size();
320320
//对key值的重分配
321321
for (int j = 0; j < left_len; j++) {
322-
child[i]->key.insert(child[i]->key.begin(), *(child[i-1]->key.end()-1-j));
322+
child[i]->key.insert(child[i]->key.begin(), *(child[i - 1]->key.end() - 1 - j));
323323
}
324324
child[i - 1]->key.erase(child[i - 1]->key.end() - left_len, child[i - 1]->key.end());
325325
//对record的重分配
326326
for (int j = 0; j < left_len; j++) {
327-
dynamic_cast<Leaf<T>*>(child[i])->vals.insert(dynamic_cast<Leaf<T>*>(child[i])->vals.begin(), *(dynamic_cast<Leaf<T>*>(child[i-1])->vals.end()-1-j));
327+
dynamic_cast<Leaf<T>*>(child[i])->vals.insert(dynamic_cast<Leaf<T>*>(child[i])->vals.begin(), *(dynamic_cast<Leaf<T>*>(child[i - 1])->vals.end() - 1 - j));
328328
}
329329
dynamic_cast<Leaf<T>*>(child[i - 1])->vals.erase(dynamic_cast<Leaf<T>*>(child[i - 1])->vals.end() - left_len, dynamic_cast<Leaf<T>*>(child[i - 1])->vals.end());
330330
//然后修改对应的key值
@@ -567,7 +567,6 @@ bool Leaf<T>::Insert(T ele, int val) {
567567
TreeNode<T>* find_result = Find(ele, index);
568568

569569
if (find_result != NULL && index >= 0) {
570-
cout << "Key already in Bplus Tree! Insert failed." << endl;
571570
return false;
572571
} else if (find_result == NULL) {
573572
this->key.insert(this->key.begin(), ele);
@@ -586,7 +585,6 @@ bool Leaf<T>::Delete(T ele) {
586585
int index;
587586
TreeNode<T>* find_result = Find(ele, index);
588587
if (find_result == NULL || index < 0) {
589-
cout << "Key not in Bplus tree! Delete failed!" << endl;
590588
return false;
591589
} else {
592590
this->key.erase(this->key.begin() + index, this->key.begin() + index + 1);
@@ -633,7 +631,6 @@ void BPlusTree<T>::searchRange(T& key1, T& key2, std::vector<int>& vals, int fla
633631
TreeNode<T>* fir;
634632
fir = root->Find(key1, index);
635633
if (fir == NULL && index == -1) {
636-
cout << "Bplus tree empty! Search failed." << endl;
637634
} else if (fir == NULL && index == 0) {
638635
fir = root;
639636
for (int i = 0; i < root->key.size() && root->key[i] <= key2; i++) {
@@ -678,7 +675,6 @@ void BPlusTree<T>::searchRange(T& key1, T& key2, std::vector<int>& vals, int fla
678675
TreeNode<T>* fir;
679676
fir = root->Find(key1, index);
680677
if (fir == NULL && index == -1) {
681-
cout << "Bplus tree empty! Search failed." << endl;
682678
} else if (fir == NULL && index == 0) {
683679
fir = root;
684680
for (int i = 0; i < root->key.size(); i++) {

0 commit comments

Comments
 (0)