amitbansal7 / Data-Structures-and-Algorithms

Implementation of various Data Structures and algorithms - Linked List, Stacks, Queues, Binary Search Tree, AVL tree,Red Black Trees, Trie, Graph Algorithms, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Segment Trees etc.
248 stars 91 forks source link

RBT segfaults #5

Open professorcode1 opened 1 year ago

professorcode1 commented 1 year ago

Make an RBT Tree with elements from 1 to 21, including both. Now try to delete 12 the program will segfault for trying to illegally write to memory via the line

            x->parent = y;

from the main else block in RB_delete

professorcode1 commented 1 year ago

Its a simple fix. Would you like me to open a PR?