Given binary tree with n nodes, perform following operations on it: Perform preorder and post order traversal • Create a mirror image of it • Find the height of tree • Copy this tree to another [operator=] • Count number of leaves, number of internal nodes. Erase all nodes in a binary tree. (implement both recursive and non-recursive methods)

Comments

Popular posts from this blog

There are flight paths between cities. If there is a flight between city A and city B then there is an edge between the cities. The cost of the edge can be the time that flight takes to reach city B from A, or the amount of fuel used for the journey. Represent this as a graph. The node can be represented by airport name or name of the city. Use adjacency list representation of the graph or use adjacency matrix representation of the graph. Justify the storage representation used.(Operation to be performed adding and deleting edge, adding and deleting vertices, calculated in-degree and out-degree for directed graph and and degree of a node for undirected graph, Use any traversal to traverse graph)