Root node should have an assigned node, but remains NULL. Why can't I assign a node to my root?

后端 未结 1 520
夕颜
夕颜 2021-01-29 12:28

I\'m writing a binary tree in object-oriented format. I\'ve had experience with binary trees before, but it\'s been a while since I\'ve touched on this. My problem is that I\'m

相关标签:
1条回答
  • 2021-01-29 13:14

    change from:

    node* insert(node* cur, string&);
    

    to :

    node* insert(node* &cur, string&);
    

    should fix

    Of course the implementation header should also be changed

    0 讨论(0)
提交回复
热议问题