0% found this document useful (0 votes)
71 views

Assignment 4 PDF

This document provides instructions for writing programs to perform operations on binary trees. It includes: 1) Creating a complete binary tree from a list of characters and functions for finding nodes, computing heights and depths, and checking if the tree is complete. 2) Constructing a binary tree from its level order and in-order traversals. 3) Creating a threaded binary tree from an inorder traversal and transforming a BST so each node contains the sum of nodes greater than it. 4) Another instruction to construct a binary tree from level order and inorder traversals. 5) A function for a BST that checks if the sum of nodes in the left subtree is equal to, greater than, or less than the sum of nodes in the

Uploaded by

Ritik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Assignment 4 PDF

This document provides instructions for writing programs to perform operations on binary trees. It includes: 1) Creating a complete binary tree from a list of characters and functions for finding nodes, computing heights and depths, and checking if the tree is complete. 2) Constructing a binary tree from its level order and in-order traversals. 3) Creating a threaded binary tree from an inorder traversal and transforming a BST so each node contains the sum of nodes greater than it. 4) Another instruction to construct a binary tree from level order and inorder traversals. 5) A function for a BST that checks if the sum of nodes in the left subtree is equal to, greater than, or less than the sum of nodes in the

Uploaded by

Ritik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1. You have been given a list of characters as {A, B, C, D, E, F, G, H, and I).

Write a program to insert


these elements into a complete binary tree. Also, write the code to perform all the functionalities on the
constructed binary tree,
a. To find a node with specified value
b. To compute height of a given node
c. To compute the depth of a node
d. To check whether the given tree is complete binary tree or not

2. Write a program to construct a binary tree from its level order and in-order traversal.

3. Given a binary tree and inorder traversal, construct a new binary tree with additional pointers
such that the inorder traversal is reflected in the new tree (Hint: Threaded binary tree). Given a
BST, transform it into greater sum tree where each node contains sum of all nodes greater than that
node.

4. Construct a binary tree from its level order and in-order traversal.

5. In a binary search tree, write a function to checks if the sum of all the nodes in left sub tree of the
node is equal or greater or lesser than the sum of all the nodes in right sub tree of the node.

You might also like