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

  • @[email protected]
    link
    fedilink
    English
    210 months ago

    In the get() function, instead of if{}… if{}… return it should be if{}… else if{}… else {return…}

    • @lawmurray
      link
      110 months ago

      This would be better style in my opinion, but by way of correctness it seems the more fundamental issue is “return” missing in the if… else if… blocks.