NEW
Font size
WorksheetsCYBERSYNAPSE
Total questions: 15
Worksheet time: 15mins
Which of the following sorting algorithms has the best worst-case time complexity?
Merge Sort
Quick Sort
Bubble Sort
Selection Sort
Which algorithm is used to find the shortest path in an unweighted graph?
Bellman-Ford Algorithm
Kruskal’s Algorithm
Dijkstra’s Algorithm
Breadth-First Search
Which data structure is best suited for implementing a priority queue?
Stack
Queue
Heap
Graph
In hashing, which technique is used to reduce collisions by mapping two keys to different slots?
Open Addressing
Chaining
Dynamic Rehashing
Dynamic Rehashing
What is the time complexity of following code?
int a = 0, i = N;
while (i > 0) {
a += i; i /= 2;
}
O(sqrt(N) )
O(log(N))
O(N)
O(N/2)
The given array is arr = {1, 2, 4, 3}. Bubble sort is used to sort the array elements. How many iterations will be done to sort the array?
4
2
1
0
Consider a binary tree with n nodes, where each node can have at most two children. The height of the tree is defined as the maximum number of edges between the root node and any leaf node. Which of the following statements is true regarding the height h of this binary tree?
The height of the tree is always equal to n-1
The height of the tree can be greater than or equal to n-1
The height of the tree is always equal to log₂(n)
The height of the tree can be greater than or equal to log₂(n)
Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the in-order traversal sequence of the resultant tree
7 5 1 0 3 2 4 6 8 9
0 2 4 3 1 6 5 9 8 7
0 1 2 3 4 5 6 7 8 9
9 8 6 4 2 3 0 1 5 7
B+ Trees are considered BALANCED because
the lengths of the paths from the root to all leaf nodes are all equal
the lengths of the paths from the root to all leaf nodes differ from each other by at most 1
the number of children of any two non-leaf sibling nodes differ by at most 1
the number of records in any two leaf nodes differ by at most 1
Which operation has a worse time complexity in a dynamic array when it needs to expand its size?
Accessing an element by index
Appending an element at the end
Inserting an element at the beginning
Searching for an element
Inserting an element at the beginning
By checking if the next pointer of any node is null
Using a hash table to store visited nodes
Comparing each node with every other node
Using two pointers at different speeds
Which data structure is most efficient for implementing a priority queue?
Binary search tree
Binary heap
Linked list
Hash table
What technique is commonly used in dynamic programming to optimize recursive algorithms?
Memoization
Randomization
Backtracking
Linear search
The data structure used to check whether an expression contains a balanced parenthesis is?
Queue
Stack
Tree
Array
Given an undirected graph G with V vertices and E edges, what will be the sum of the degrees of all vertices?
E
2E
V + E
2V
