Data Structures and Algorithms MCQs with Answers
Try the topic preview and open any solution for a worked explanation.
Question 1
The postfix form of the expression (A + B) * (C * D ‐ E) * F / G is _______ .
Question 2
Which of the given options provides the increasing order of asymptotic complexity of functions f1, f2, f3 and f4?
A. f1(n) = 2n
B. f2(n) = n3/2
C. f3(n) = n log n
D. f4(n) = nlog n
Question 3
In the following table, the left column contains the names of standard graph algorithms and the right column contains the time complexities of the algorithms. Here, n and m are number of vertices and edges, respectively. Match each algorithm with its time complexity.
| List I (Standard graph algorithms) | List II (Time complexities) |
|---|---|
| A. Bellman-Ford algorithm | I. O(m*log n) |
| B. Kruskal’s algorithm | II. O(n3) |
| C. Floyd-Warshall algorithm | III. O(n*m) |
| D. Topological sorting | IV. O(n+m) |
Question 4
A data structure is required for storing a set of integers such that each of the following operations can be done in O(log n) time, where n is the number of elements in the set.
Deletion of the smallest element
Insertion of an element if it is not already present in the set
Which of the following data structures can be used for this purpose?
Question 5
A hash table has space for 75 records. What is the approximate probability of a collision when 6 records are inserted (i.e. when the table is 8% full)?
Question 6
The number of nodes in a complete binary tree of height h (with root at level 0) is equal to:
Question 7
What item is at the root after the following sequence of insertions into an empty splay tree :
1, 11, 3, 10, 8, 4, 6, 5, 7, 9, 2, ?
Question 8
Suppose we are implementing quadratic probing with a Hash function, Hash(y) = X mode 100. If an element with key 4594 is inserted and the first three locations attempted are already occupied, then the next cell that will be tried is :
Question 9
What operation is supported in constant time by the doubly linked list, but not by the singly linked list ?
Question 10
Practise for these exams
-
UGC NET Computer Science and Applications
-
UGC NET Paper I