A) To create a binary tree T1 with node containing age of a person and check whether the tree constructed is a binary search tree or not based on age. Also display the nodes containing age of second...


A) To create a binary tree T1 with node containing age of a person and check whether the tree<br>constructed is a binary search tree or not based on age. Also display the nodes containing age of<br>second youngest and age of second eldest person without using global variables, array and<br>sorting.<br>B) Include a function which checks whether a given tree, T2, is the sub-tree of T1. Return a<br>pointer to the matching subtree TX. Pointers to the root of first tree (T1) and second tree(T2) are<br>passed as parameters to the function (A subtree of a tree T is a tree S consisting of a node in T<br>and all of its descendants in T. The subtree corresponding to the root node is the entire tree; the<br>subtree corresponding to any other node is called a proper subtree.).<br>Example Input/Output:<br>A)<br>Figure 1: T1<br>The given tree T1 is not a binary search tree<br>Age of second youngest person is 3<br>Age of second eldest person is 8<br>В)<br>26<br>10<br>10<br>10<br>4<br>4<br>6.<br>30<br>30<br>T1<br>T2<br>T3<br>T2 is a subtree of T1, and T3 is not a subtree of T1. T3 is not a subtree of T1.<br>16<br>

Extracted text: A) To create a binary tree T1 with node containing age of a person and check whether the tree constructed is a binary search tree or not based on age. Also display the nodes containing age of second youngest and age of second eldest person without using global variables, array and sorting. B) Include a function which checks whether a given tree, T2, is the sub-tree of T1. Return a pointer to the matching subtree TX. Pointers to the root of first tree (T1) and second tree(T2) are passed as parameters to the function (A subtree of a tree T is a tree S consisting of a node in T and all of its descendants in T. The subtree corresponding to the root node is the entire tree; the subtree corresponding to any other node is called a proper subtree.). Example Input/Output: A) Figure 1: T1 The given tree T1 is not a binary search tree Age of second youngest person is 3 Age of second eldest person is 8 В) 26 10 10 10 4 4 6. 30 30 T1 T2 T3 T2 is a subtree of T1, and T3 is not a subtree of T1. T3 is not a subtree of T1. 16

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here