- Jan 6, 2023
- 11
Hello everyone, I'm expected to develop the ThreadedNode() class, but I'm having some difficulties with it.
I understand that a threaded binary tree of a binary tree is generated by assigning every null left child to the node in the inorder traversal's predecessor and every null right child to the node in the inorder traversal's successor. My issue, though, begins with the constructor // thread the binary tree when given the root public ThreadedNode(BinaryNode root)
According to this article, a frequent approach to generate threaded binary trees is using a phoney head. This simplifies the construction of single node trees and simplifies the constructor. Is that correct?
I understand that it accepts a binaryNode and that I must construct a threaded tree, but how do I do so?
I understand that a threaded binary tree of a binary tree is generated by assigning every null left child to the node in the inorder traversal's predecessor and every null right child to the node in the inorder traversal's successor. My issue, though, begins with the constructor // thread the binary tree when given the root public ThreadedNode(BinaryNode root)
According to this article, a frequent approach to generate threaded binary trees is using a phoney head. This simplifies the construction of single node trees and simplifies the constructor. Is that correct?
I understand that it accepts a binaryNode and that I must construct a threaded tree, but how do I do so?