forked from jhflorey/HackerRank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasicAlgorithmQuiz
executable file
·102 lines (75 loc) · 2.56 KB
/
BasicAlgorithmQuiz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
This is a set of multiple choice questions, provided entirely for your self-assessment, and is based on the the most fundamental aspects of data structure and algorithms. The level of the questions is no more than that of what one would encounter in an introductory Data Structures class.
Question 1.
Which of these is the worst case time complexity of Quick Sort - and cannot be expressed in lower order terms ?
(a) O(n)
(b) O(n log n)
(c) O(n2)
(d) O(n3)
(e) O(log n)
Question 2.
Which of these is the worst case time complexity of Merge Sort - and cannot be expressed in lower order terms ?
(a) O(n)
(b) O(n log n)
(c) O(n2)
(d) O(n3)
(e) O(log n)
Question 3.
Which of these is the average case time complexity of Merge Sort - and cannot be expressed in lower order terms ?
(a) O(n)
(b) O(n log n)
(c) O(n2)
(d) O(n3)
(e) O(log n)
Question 4.
Which of these is the time complexity involved in building a heap of n elements - and cannot be expressed in lower order terms ?
(a) O(n)
(b) O(n log n)
(c) O(n2)
(d) O(n3)
(e) O(log n)
Question 5.
A heap is a particular kind of a binary search tree. This statement is:
(a) True
(b) False
Question 6.
The Dijkstra algorithm for finding the shortest paths involves the traversal of nodes in an order similar to: (a) Breadth first search
(b) Depth first search
(c) Topological sort
(d) None of these
Question 7.
Which of the following statements is true? (The total number of push/pop/enque/deque calls made should not depend on the number of elements in the stack or queue)
(a) A queue can be created using two stack data-structures.
(b) A stack can be created using two queue data-structures. (c) Both the above statements (a and b) are true.
(d) Both the above statements (a and b) are false.
Question 8.
A union find data-structure is commonly applied while implementing:
(a) A depth-first search traversal of a graph.
(b) A breadth-first search traversal of a graph.
(c) Computing the minimum spanning tree of a graph.
(d) Computing the all-pairs shortest path in a graph.
Question 9.
Which of these is the worst case time complexity for looking up a key in a binary search tree - and cannot be expressed in lower order terms ?
(a) O(n)
(b) O(n log n)
(c) O(n2)
(d) O(n3)
(e) O(log n)
Question 10.
The graph algorithm which forms an essential component of the ‘make’ or ‘ant build’ used by programmers and software developers is:
(a) Flow maximization algorithm (b) Shortest path algorithm
(c) Minimum spanning tree algorithm
(d) Bipartite matching
(e) Topological sort
=======
Answer:
=======
1:c
2:b
3:b
4:a
5:b
6:a
7:a
8:c
9:a
10:e