PetarV- / Algorithms

Several algorithms and data structures implemented in C++ by me (credited to others where necessary).
MIT License
645 stars 235 forks source link

Bag in delete function. #24

Closed BorisovSergei113 closed 3 years ago

BorisovSergei113 commented 5 years ago

Hi, i found bug in delete function in data structure Splay Tree. For example: 6 / \ 5 15 I want delete 15, after splay 15 tree will see: 15 / 6 / 5 In condition (right_tree == nullptr), root save pointer on right element, but after delete - right element is not available. 6 / \ 5 ? I think need add M->rightChild == nullptr in (right_tree == nullptr) condition and similarly in (right_tree == nullptr).