We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a2d8912 commit 954fc39Copy full SHA for 954fc39
remove.cpp
@@ -48,7 +48,7 @@ void BPTree::removeKey(int x) {
48
49
auto itr = lower_bound(cursor->keys.begin(), cursor->keys.end(), x);
50
51
- if (itr == cursor->keys.end()) {
+ if (found == false) {
52
cout << "Key Not Found in the Tree" << endl;
53
return;
54
}
@@ -83,7 +83,7 @@ void BPTree::removeKey(int x) {
83
84
85
cout << "Deleted " << x << " From Leaf Node successfully" << endl;
86
- if (cursor->keys.size() >= (getMaxLeafNodeLimit()+1) / 2) {
+ if ((cursor->keys.size() >= (getMaxLeafNodeLimit() + 1) / 2) || (cursor == root)) {
87
//Sufficient Node available for invariant to hold
88
89
0 commit comments