- What is the difference between a parent node and child node?
- How do you find the parent of a tree node?
- Can a node be a parent and a child?
- What do you call the children of the same parent node?
What is the difference between a parent node and child node?
Parent node: A parent node is a node connected to your modem or gateway. Child node: A child node is another node that extends your network.
How do you find the parent of a tree node?
Approach: Write a recursive function that takes the current node and its parent as the arguments (root node is passed with -1 as its parent). If the current node is equal to the required node then print its parent and return else call the function recursively for its children and the current node as the parent.
Can a node be a parent and a child?
Yes it can. You just need to make sure that for all vertices c in the left subtree of p it must hold that val(c)\leq val(p), and similarily for the right subtree val(c)\geq val(p).
What do you call the children of the same parent node?
An internal node has one or more child nodes and is called the parent of its child nodes. All children of the same node are siblings.