Miscellaneous on Data Structure and Algorithms related Questions and Answers

Question 1 : What will be the worst case time complexity of code to find sum in given query range (l,r) in an array of size n with q number of such queries?
1. O(n)
2. O(q)
3. O(n*q)
4. O(n+q)
View Answer   Discuss with Members

Question 2 : Total how many iterations are required to find the sum of elements in a given range of (l,r) in an array of size n when we use square root optimization?
1. vn
2. 2*vn
3. 3*vn
4. n*vn
View Answer   Discuss with Members

Question 3 : What will be the worst case time complexity of finding the sum of elements in a given range of (l,r) in an array of size n when we use square root optimization?
1. O(n)
2. O(l+r)
3. O(vn)
4. O(r-l)
View Answer   Discuss with Members

Question 4 : What will be the worst case time complexity of finding the sum of elements in a given range of (l,r) in an array of size n?
1. O(n)
2. O(l+r)
3. O(l-r)
4. O(r-l)
View Answer   Discuss with Members

Question 5 : What will be the output if quickselect algorithm is applied to the array arr={1,5,4,3,7} with k given as 4?
1. 1
2. 3
3. 4
4. 5
View Answer   Discuss with Members

Question 6 : Most Efficient Time Complexity of Topological Sorting is? (V – number of vertices, E – number of edges)
1. O(V + E)
2. O(V)
3. O(E)
4. None of the mentioned
View Answer   Discuss with Members

Question 8 : Consider the graph shown below. Which of the following are the edges in the MST of the given graph?mcq on data structures algorithms
1. (a-c)(c-d)(d-b)(d-b)
2. (c-a)(a-d)(d-b)(d-e)
3. (a-d)(d-c)(d-b)(d-e)
4. (c-a)(a-d)(d-c)(d-b)(d-e)
View Answer   Discuss with Members

Question 9 : If all the weights of the graph are positive, then the minimum spanning tree of the graph is a minimum cost subgraph.
1. True
2. False
3.
4.
View Answer   Discuss with Members

Question 10 : Consider a undirected graph G with vertices { A, B, C, D, E}. In graph G, every edge has distinct weight. Edge CD is edge with minimum weight and edge AB is edge with maximum weight. Then, which of the following is false?
1. Every minimum spanning tree of G must contain CD
2. If AB is in a minimum spanning tree, then its removal must disconnect G
3. No minimum spanning tree contains AB
4. G has a unique minimum spanning tree
View Answer   Discuss with Members


View 1 - 10 of 49 Questions

* Be the First to Post a Comment.

Submit comment :


Captcha Image
Reload

Ask Question

Captcha Image
Reload

Note : Name and Email never shown.





Subscribe


Become a part of EducationForever. Subscribe to our FREE Newsletter