Posted on by Kalkicode
Code Binary Tree

Print cousins of given node in a binary tree

In a binary tree, a node can have up to two child nodes. The child nodes of a node are known as its left child and right child. A cousin of a node in a binary tree is a node that has the same level as the given node but does not share the same parent node.

In other words, cousins of a node in a binary tree are the nodes that are at the same depth or level as the given node but do not share the same parent as the given node.

Detecting and print cousins of given binary tree node

Code Solution

Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment