Populating Next Right Pointers in Each Node
Populating Next Right Pointers in Each Node
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}Given the following perfect binary tree,
1
/ \
2 3
/ \ / \
4 5 6 7
After calling your function, the tree should look like:
1 -> NULL
/ \
2 -> 3 -> NULL
/ \ / \
4->5->6->7 -> NULLBasic Idea:
Java Code:
Populating Next Right Pointers in Each Node II

Basic Idea:
Update C++ Code for the Follow Up Question:
Last updated