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.).

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Code has to be in C Language.

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
Transcribed Image 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
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY