Computer Knowledge
Data Structures and Algorithms
1,256 Questions
Data Structures and Algorithms form the core of computer science, focusing on arrays, linked lists, trees, and sorting mechanisms. These concepts are essential for solving complex computational problems efficiently. Test takers preparing for technical and administrative IT exams will find these questions highly relevant.
Array OperationsLinked List ApplicationsSorting AlgorithmsTree Data StructuresMultilevel IndexingAlgorithm Time Complexity
Data Structures and Algorithms Questions
-
Values of in the left subtree are less than root.
-
Values of in the right subtree are greater than or equal to the root.
-
Each subtree is itself a binary search tree.
-
They do not have a recursively defined data structure.
-
The nodes at the lowest levels of the tree are known as leaves.
D
Correct answer
Explanation
This is the wrong answer since they have a recursively defined data structure.
-
Insertion sort
-
Quick sort
-
Selection sort
-
Bubble sort
-
Binary search
B
Correct answer
Explanation
It is a right answer since it is based on 'divide and conquer' method, which requires a middle element. Pivot is used for this.
-
any element is inserted into the data structure
-
any element is deleted from the data structure
-
a data structure is empty and you are trying to delete any element from it
-
a data structure is full and you are trying to insert any element into it
-
a data structure is half empty
D
Correct answer
Explanation
This is the right operation. This condition is called overflow.
-
singly linked list
-
circular singly linked list
-
doubly linked list
-
circular doubly linked list
-
header linked list
B
Correct answer
Explanation
Circular singly linked list is a linked list where the pointer in the last node points back to the first node.
-
K J I N M L
-
K J M N L I
-
M N L K J I
-
N M K L J I
-
N M L K I J
B
Correct answer
Explanation
This is the correct postorder traversal of the binary tree. Here, we first create the tree using preorder and inorder traversal. Then, find out postorder traversal. First select root from the given preorder that is I. Now, select its left subtree nodes and the right subtree nodes from inorder. We continue to apply this process until all nodes are not finished.
-
P Q S T R U
-
P Q R S T U
-
P Q S R U T
-
Q S T P R U
-
P Q S R T U
A
Correct answer
Explanation
This is the correct preorder traversal of the binary tree. Here, we first create the tree using postorder and inorder traversals. Then, find out the preorder traversal. First select root from given postorder that is P, now select its left subtree [LST] nodes and right subtree [RST] nodes from inorder. The LST node of root P is S Q T and RST nodes of P is R U. Now, take S Q T and apply the same process. Here, we get root node Q from postorder [S T Q] and its LST and RST nodes from inoder [S Q T]. Similary, we take R U and apply the same process. Here, we get root node R from postorder [U R] and its LST and RST nodes from inoder [R U].
-
Division method
-
Folding method
-
Midsquare method
-
Multiplicative method
-
Digit analysis
B
Correct answer
Explanation
In folding method, a key is broken into several parts and each part has the same length as that of the required address except the last part.
-
0 child or leaf node
-
3 child nodes
-
1 child node
-
2 child node
-
m child nodes
D
Correct answer
Explanation
When a node with 2 child nodes is deleted, then it is replaced by its next inorder successor node.
-
full binary tree
-
complete binary tree
-
skewed binary tree
-
binary search tree
-
B-tree
B
Correct answer
Explanation
Complete bianry tree is a type of binary tree in which all levels except possibly the last are full, and the last level has all its nodes to the left side.
-
Counting Sort
-
Radix Sort
-
Merge Sort
-
Decision Tree
-
Algorithm
B
Correct answer
Explanation
It solves the problem of cards sorting counterintuitively by sorting on the least significant digit first.
-
Big-Omega Notation
-
Little-O Notation
-
Space Complexity
-
Time Complexity
-
Effectiveness
A
Correct answer
Explanation
It expresses the lower bound of the running time of an algorithm.
-
Double Hashing
-
Extendible Hashing
-
Probe Sequence
-
Chaining
-
Dynamic Hashing
B
Correct answer
Explanation
It achieves its goal by merging the concepts of a radix search tree and hashing.
-
Counting Sort
-
Bucket Sort
-
Decision Tree
-
Merge Sort
-
Direct Sequence
B
Correct answer
Explanation
It runs linear time when input is drawn from a uniform distribution.
-
Space Complexity
-
Little-O Notation
-
Theta Notation
-
Time Complexity
-
Algorithm
C
Correct answer
Explanation
It represents the upper bound and the lower bound of the running time of an algorithm.
-
Double Hashing
-
Buckets
-
Directory
-
Linear Probing
-
Dynamic Hashing
D
Correct answer
Explanation
Here, we start searching the hash table sequentially from the beginning of the original hash location if a location is occupied, we check the next location.