MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
An ____ is any node in the path from root to the node.
A
Ancestor
B
Descendent
C
tree
D
none of above
Explanation: 

Detailed explanation-1: -An ancestor of a node is any other node on the path from the node to the root. A descendant is the inverse relationship of ancestor: A node p is a descendant of a node q if and only if q is an ancestor of p.

Detailed explanation-2: -A node’s “parent” is a node one step higher in the hierarchy (i.e. closer to the root node) and lying on the same branch. “Sibling” ("brother” or “sister") nodes share the same parent node. A node’s “uncles” are siblings of that node’s parent. A node that is connected to all lower-level nodes is called an “ancestor".

Detailed explanation-3: -The root node is therefore an ancestor of all nodes within the tree.

Detailed explanation-4: -A postorder traversal is one where the left subtree is traversed first, followed by the right subtree and the root is traversed at the end. If the given node is found at either the left subtree of the right subtree for any node, the the current node in the traversal would be the ancestor of the node.

Detailed explanation-5: -In a tree, the root is the only node with no proper ancestors. A node with no proper descendants is called a leaf. A subtree of a tree is a node, together with all its descendants. The height of a node in a tree is the length of a longest path from the node to a leaf.

There is 1 question to complete.