Algorithms and Data Structures
English
Intermedio
This is a Multiple Choice Questions (MCQs) based on Data Structures and Algorithms, where you will be given four options.
Descripción
Data structures, Algorithms, Trees, Graphs, Arrays, Heaps, Queues, Stacks, Computer science, Interview
Etiquetas
35
Preguntas
30 s
Por pregunta
8:56
Tiempo promedio
Descalificado
Puntuación del concurso
3,3
Clasificación de la comunidad
415
Participantes
Unfortunately, this test will not be able to receive a prize:
Not an original test. Some questions were copied from other sources. E.g.
#q1 "What will be the running-time of Dijkstra's single source shortest path algorithm, if the graph G(V,E) is stored in form of adjacency list and binary heap is used?" <= https://compscibits.com/Data-Structures-and-Algorithms/Graphs/discussion/4120
#q2 "Which of the following has search effeciency of Ο(1)?" <= https://compscibits.com/Data-Structures-and-Algorithms/Sorting-and-Searching/discussion/4070, etc.
Just a small remark, for some questions (Q17, Q23) about the operations with stack, 30 seconds is not enough.
Consider you have a stack whose elements in it are as follows.
5 4 3 2 << top
Where the top element is 2. You need to get the following stack 6 5 4 3 2 << top The operations that needed to be performed are (You can perform only push and pop):
Your answer is Push(pop()), push(6), push(pop()).
pop() deletes and returns the top element of stack. push(x) adds element x to the top of stack. So push(pop()) simply does nothing with stack. This answer is incorrect.
What will be result if the given stack is popped?
S
E R
Your answer is S E R.
Here is the same, pop() returns the top element of stack, so result will be S.
If we're using a stack, what are the set of functions that are to be executed to get the following output?
cat
Your answer is push(c,s); pop(s); push(a,s); pop(s);push(t,s);pop(s);
What does s mean here?
Your answer is TREE, but explanation says that all options are correct and the best answer is HEAP.
There are two identical correct options
Your answer is circular doubly linked list.
But doubly linked lists can also be concatenated in O(1).
Your answer is selection sort.
Merge sort divides list into TWO SEPARATE SUB-LISTS, sorts them separately and then merges them into one list.
Quick sort reorders list using pivot element, then divides list into TWO SEPARATE SUB-LISTS, and sorts them separately.
So all these answers are correct.
Your answer: 2, 4, 4, 5, 7, 9
Obviously, 2, 3, 4, 5, 6, 7 is correct answer too, it is Non-Decreasing Order: 2<=3<=4<=5<=6<=7.
What is the path compression algorithm?
What is the special case?
Your order is push(A), push(B), push(C), push(D), pop(), pop(), pop(), pop().
But this order is also possible: push(A), pop(), push(B), pop(), push(C), pop(), push(D), pop() and answer will be ABCD.
So I think that question is ambiguous.
Your answer is simplicity.
But pairing heap is time efficient too.
Read here: https://en.wikipedia.org/wiki/Pairing_heap
The analysis of pairing heaps' time complexity was initially inspired by that of splay trees.[1] The amortized time per delete-min is O(log n), and the operations find-min, meld, and insert run in O(1) amortized time.[3]
*The stack question with push() and pop(), s is not clearly defined.
*For the priority queue question, the answer says tree yet the best answer is Heap as indicated in the explanation.
*Concatenation of two lists can be achieved with both circular and double linked list with O(1).
*Path compression algorithm question is vague.
*Asking time complexity for insertion and deletion on array, says special case; What special case?
Anyways, good effort. Good luck:)