Sale!

CSS 352 Assignment 6 solution

Original price was: $35.00.Current price is: $30.00. $25.50

Download Details:

  • Name: Assignment-6-Binary-Trees-cvvo2p.zip
  • Type: zip
  • Size: 9.02 KB

Category:

Description

5/5 - (2 votes)

1. Write a C program to create a binary tree of n nodes with data values as A, B, C, …., where n should be the user input. The user will have the full freedom to organize the nodes in the binary tree as per his/her choice.

2. Write a C program to implement the following operations on a binary tree
– Insert a new node as a leaf node
– Delete a specified leaf node.

3. A binary tree is given which is represented using a single array. Write a C program to convert the same tree into a linked structure. [OPTIONAL]

4. Repeat problem 3 when a given binary tree is represented with a linked structure. Write C program to build the same tree which will be stored in an array of suitable size. [OPTIONAL]

5. Considering linked list representation of a binary tree, write a C program that uses recursive functions to find the total number of nodes, number of edges and the maximum depth or height of a binary tree.
[Hint: For height calculation, recursively calculate height of left and right subtrees of a node and assign height to the node as max of the heights of two children plus 1.]

6. Consider two binary trees T1 and T1. Write a C program to merge two binary trees.
[Hint: The entire tree T2 (or T1) can be merged as a subtree of T1 (or T2). This requires a null subtree in either or both trees.]

7. Write a C program to implement the three different tree traversal techniques (inorder, preorder and postorder) for a binary tree.

8. Given a postfix expression, write a program to construct an expression tree.