typedef struct treeNode* treeptr;
struct treeNode
{
treeptr leftMostChild, rightSibling;
};
int DoSomething (treeptr tree)
{
int value=0;
if (tree != NULL) {
if (tree->leftMostChild == NULL)
value = 1;
else
value = DoSomething(tree->leftMostChild);
value = value + DoSomething(tree->rightSibling);
}
return(value);
}Related Programming & Data Structures PYQs
Consider a binary tree T that has 200 leaf nodes. Then, the number of nodes in T that have exactly two children are
The height of a tree is the length of the longest root- to-leaf path in it. The maximum and minimum number of nodes in a binary tr…
While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the…
A priority queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is: 10, 8, 5, 3…
Consider the C function given below. Assume that the array listA contains n(>0) elements, sorted in ascending order int ProcessArr…
The height of a tree is defined as the number of edges on the longest path in the tree. The function shown in the pseudocode below…
Free account benefits
Turn practice into measurable progress
Public PYQs and reference pages stay free. Sign in when you want GATEverse to remember what you studied and guide what to practise next.