this post was submitted on 13 Sep 2023
8 points (100.0% liked)
C++
1765 readers
1 users here now
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Your get() function will always just return the value of the root node. I think you mean to have return get(value, ...) in each of its if statements.
it worked, thank you :D
Nice, good luck with it from here!
i managed to do it (or thats what i think), the tree apparently works, but i dont know if its balanced, can you have a look at my code? i want to know if my tree is balanced correctly, here is the code: https://pastebin.com/ineG07b2 (PS: im aware that this code doesnt guarantee that the root will be black, the wikipedia article says that the black root is not a strict requirement by all the authors, so i decided to omit that)