Algorithm for creating Iterator for BinaryTree class
问题 I want to add Bi-Directional Iterator (like Iterator exported by std::set) in my Parametrized BinaryTree class but I'm unable to comeup with any algorithm. Simply structure of Binary tree node is , it contains three pointers , left , right , parent: 回答1: With the given structure you want to proceed like this: To start the iteration you would find the left-most node. To go to the next node the operation depends on where you currently are: If your node has a right child you go to this child and