@@ -319,12 +319,12 @@ void NonLeaf<T>::RedistributeLeaf(int i) {
319
319
left_len = new_len - this ->child [i]->key .size ();
320
320
// 对key值的重分配
321
321
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));
323
323
}
324
324
child[i - 1 ]->key .erase (child[i - 1 ]->key .end () - left_len, child[i - 1 ]->key .end ());
325
325
// 对record的重分配
326
326
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));
328
328
}
329
329
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 ());
330
330
// 然后修改对应的key值
@@ -567,7 +567,6 @@ bool Leaf<T>::Insert(T ele, int val) {
567
567
TreeNode<T>* find_result = Find (ele, index );
568
568
569
569
if (find_result != NULL && index >= 0 ) {
570
- cout << " Key already in Bplus Tree! Insert failed." << endl;
571
570
return false ;
572
571
} else if (find_result == NULL ) {
573
572
this ->key .insert (this ->key .begin (), ele);
@@ -586,7 +585,6 @@ bool Leaf<T>::Delete(T ele) {
586
585
int index ;
587
586
TreeNode<T>* find_result = Find (ele, index );
588
587
if (find_result == NULL || index < 0 ) {
589
- cout << " Key not in Bplus tree! Delete failed!" << endl;
590
588
return false ;
591
589
} else {
592
590
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
633
631
TreeNode<T>* fir;
634
632
fir = root->Find (key1, index );
635
633
if (fir == NULL && index == -1 ) {
636
- cout << " Bplus tree empty! Search failed." << endl;
637
634
} else if (fir == NULL && index == 0 ) {
638
635
fir = root;
639
636
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
678
675
TreeNode<T>* fir;
679
676
fir = root->Find (key1, index );
680
677
if (fir == NULL && index == -1 ) {
681
- cout << " Bplus tree empty! Search failed." << endl;
682
678
} else if (fir == NULL && index == 0 ) {
683
679
fir = root;
684
680
for (int i = 0 ; i < root->key .size (); i++) {
0 commit comments