Writing a function to swap a binary tree


Question 1) Create the binary search tree and execute

• Preorder traversal (recursive and non recursive)

• Inorder traversal (recursive and non recursive)

• Postorder traversal (recursive and non recursive)

Question 2) Write a program to count the number of leaf nodes in a binary tree.

Question 3) Write a program to list the list the data fields of a binary tree level by level. Within levels, nodes are to be listed from left to right.

Question 4) Write a program to compute the height of a binary tree.

Question 5) Write a program to check that two binary trees are similar.

Question 6) Construct two binary trees so that their preorder traversal sequences are the same.

Question 7) Construct two binary trees so that their postorder traversal sequences are the same.

Question 8) Write a function to swap a binary tree.

Question 9) Write a function to calculate the maximum number of nodes in any level of a binary tree. The maximum number of nodes in any level of a binary tree is also called the width of the tree

Question 10) Write a function to find out the inorder successor of a given node in a binary tree. The inputs to the function are a pointer to the root of the tree and a pointer to a node. The function returns a pointer to the inorder successor of the given node.

Question 11) Write a function to find out the inorder predecessor of a given node in a binary tree. The inputs to the function are a pointer to the root of the tree and a pointer to a node. The function returns a pointer to the inorder predecessor of the given node.

Question 12) Write a function to calculate the internal path length of a binary tree.

Question 13) Write a function to calculate the external path length of a binary tree.

Question 14) Write the function to delete a node from binary search tree which ultimately deletes the inorder predecessor of the node to be deleted if the node has exactly two non empty children.

Question 15) Write a function to check whether given binary search tree is an AVL tree or not.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Writing a function to swap a binary tree
Reference No:- TGS04914

Expected delivery within 24 Hours