Skip to content

Tag Archives: Data Structures

Which data structure is used for balancing of symbols? (A) Stack (B) Queue (C) Tree (D) Graph Answer: (A) Explanation: Stack is used for balancing… 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
A program P reads in 500 integers in the range [0..100] representing the scores of 500 students. It then prints the frequency of each score… Read More
A Priority-Queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is given below: 10, 8, 5, 3,… Read More
The time complexity of computing the transitive closure of a binary relation on a set of n elements is known to be: (A) O(n) (B)… 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
Which of the following traversal outputs the data in sorted order in a BST? (A) Preorder (B) Inorder (C) Postorder (D) Level order Answer: (B)Explanation:… Read More
Following is an incorrect pseudocode for the algorithm which is supposed to determine whether a sequence of parentheses is balanced:  C declare a character stack… Read More
Consider the following pseudocode that uses a stack  C declare a stack of characters while ( there are more characters in the word to read… Read More
How many distinct binary search trees can be created out of 4 distinct keys? (A) 4 (B) 14 (C) 24 (D) 42 Answer: (B) Explanation:… Read More
How many different insertion sequences of the key values using the hash function h(k) = k mod 10 and linear probing will result in the… Read More
A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty… Read More
The following C function takes a simply-linked list as input argument. It modifies the list by moving the last element to the front of the… Read More
The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in decreasing order. Which of the… Read More