# Tag Archives: Data Structures

What does the following function do for a given binary tree? int fun(struct node *root) {    if (root == NULL)       return 0;    if (root->left ==… Read More
What is the time complexity of Build Heap operation. Build Heap is used to build a max(or min) binary heap from a given array. Build… Read More
The maximum number of binary trees that can be formed with three unlabelled nodes is: (A) 1 (B) 5 (C) 4 (D) 3 Answer: (B)Explanation:… Read More
In a complete k-ary tree, every internal node has exactly k children or no child. The number of leaves in such a tree with n… Read More
Level of a node is distance from root to that node. For example, level of root is 1 and levels of left and right children… Read More
What are the main applications of tree data structure? Manipulate hierarchical data  Make information easy to search   Manipulate sorted lists of data  Router algorithms … Read More
The inorder and preorder traversal of a binary tree are d b e a f c g and a b d e c f g,… Read More
What is common in three different types of traversals (Inorder, Preorder and Postorder)? (A) Root is visited before right subtree (B) Left subtree is always… Read More
If arity of operators is fixed, then which of the following notations can be used to parse expressions without parentheses? a) Infix Notation (Inorder traversal… Read More
Following function is supposed to calculate the maximum depth or height of a Binary tree — the number of nodes along the longest path from… Read More
Which of the following is true about Binary Trees? (A) Every binary tree is either complete or full. (B) Every complete binary tree is also… Read More
Which one of the following is an application of Queue Data Structure? (A) When a resource is shared among multiple consumers. (B) When data is… Read More
Consider the following function that takes reference to head of a Doubly Linked List as parameter. Assume that a node of doubly linked list has… Read More
Which of the following points is/are true about Linked List data structure when it is compared with array? (A) Arrays have better cache locality that… Read More
Which one of the following is an application of Stack Data Structure? (A) Managing function calls (B) The stock span problem (C) Arithmetic expression evaluation… Read More