Skip to content

Tag Archives: Data Structures-Tree Traversals

Given a binary tree, the task is to find the absolute difference between the even valued and the odd valued nodes in a binary tree.… Read More
A recursive approach to insert a new node in a BST is already discussed in the post: Binary Search Tree | SET 1. In this… Read More
Given a BST and a number. The task is to check whether the given number is equal to the sum of all the node from… Read More
Given a Binary Search Tree and a number N, the task is to find the smallest number in the binary search tree that is greater… Read More
Given a binary tree and the two nodes say ‘a’ and ‘b’, determine whether two given nodes are cousins of each other or not.Two nodes… Read More
Given two binary trees, the task is to check whether the two binary trees is a mirror of each other or not. Mirror of a Binary… Read More
The array representation of a complete binary tree contains the data in sorted order. Which traversal of the tree will produce the data in sorted… Read More
Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited in a postorder, inorder and preorder traversal. Respectively, of a complete binary tree. Which of… Read More
Consider the following C program segment struct CellNode {   struct CelINode *leftchild;   int element;   struct CelINode *rightChild; }    int Dosomething(struct CelINode *ptr) {     int… Read More
Which of the following cannot generate the full binary tree? (A) Inorder and Preorder (B) Inorder and Postorder (C) Preorder and Postorder (D) None of… Read More
Which of the following tree traversal uses a queue data structure? (A) Preorder (B) Inorder (C) Postorder (D) Level order Answer: (D) Explanation: Level order… Read More
Which traversal of tree resembles the breadth first search of the graph? (A) Preorder (B) Inorder (C) Postorder (D) Level order Answer: (D) Explanation: Breadth… Read More
Consider two binary operators ‘ ‘ and ‘‘ with the precedence of operator being lower than that of the operator. Operator is right associative while… Read More