Binary search tree traversal that compares two pointers for equality

后端 未结 2 1121
深忆病人
深忆病人 2021-02-09 22:10

I\'m reading the Cormen algorithms book (binary search tree chapter) and it says that there are two ways to traverse the tree without recursion:

using sta

2条回答
  •  没有蜡笔的小新
    2021-02-09 22:59

    Assuming that the nodes in the tree are references and the values are references, you can always call the static ReferenceEquals method on the Object class to compare to see if the references for any two nodes/values are the same.

提交回复
热议问题