7

I was trying to creating a red-black tree, and when trying to get data out of it, it always returned the same value, so i decided to try to create a very simple binary search tree, and i got the same result, so i wonder, ¿what i'm doing wrong when trying to create trees in c++? Here is the code: https://pastebin.com/L2yJJ3Nu

you are viewing a single comment's thread
view the rest of the comments
[-] lawmurray@programming.dev 3 points 1 year ago* (last edited 1 year ago)

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.

[-] prettydarknwild@lemmy.world 2 points 1 year ago
[-] lawmurray@programming.dev 2 points 1 year ago

Nice, good luck with it from here!

this post was submitted on 13 Sep 2023
7 points (100.0% liked)

C++

1754 readers
4 users here now

The center for all discussion and news regarding C++.

Rules

founded 1 year ago
MODERATORS