Data Structures and Algorithms Quiz
English
Професійний
A quiz about data structures and algorithms. This quiz would need an advance level of knowledge on programming, algorithms, data structures and computer systems.
Опис
50
Запитань
30 сек
На запитання
11:19
Середній час
Дискваліфіковано
Результат у конкурсі
4,4
Оцінка користувачів
157
Учасників
33 коментарі
Small Lizard
The small element of an array's index is called its...
The smallest element of an array's index is called its lower bound or bottom of the areay, mostly 0 since its index starts at 0.
The small element? Maybe, you meant the smalLEST INDEX?
Giant Kitten автор
Yes, it was meant in that sense.
Small Lizard
In worst case, Quick sort has the order of...
Two options "O(n²/2)" and "O(n²/4)" are equal, so this question has two correct answers.

This question appears twice in quiz.
The second appearence:
The worst case of quick sort has order...
It is correct, the only correct option in it is "O(n²)".

And once again about complexity:
Merging 4 sorted files containing 50, 10, 40, 25 records will take time complexity of...
All options "O(200)", "O(100)", "O(250)" and "O(125)" are equal too.

Read here: https://en.wikipedia.org/wiki/Big_O_notation
Giant Kitten автор
Thanks for pointing that out.
Worst case performance of Quick Sort has the order O(n²).
Merging files question was not meant as linear Big O representation, it was refering as it already sorted, it would take a total time complexity of all files.
Small Lizard
A sorting technique which passes through the list exchanging the first element with any element less than it then repeats this with the new first element is known as...
Obviously, the correct answer is selection or insertion sort, but your answer is quick sort.
Giant Kitten автор
Thank you for this comment. You are right. The given answer was wrong. The correct answer should have been Selection Sort. Selection sort can be implemented as a stable sort. If, rather than swapping in step 2, the minimum value is inserted into the first position (that is, all intervening items moved down), the algorithm is stable.
Small Lizard
The minimum number of multiplications and additions required to evaluate the polynomial
P = 4x³ + 6x² + 9x + 34 is
Here, answer is correct, but explanation is wrong. What best scenario? We need to calculate P = 4x³ + 6x² + 9x + 34 for any x given.
Correct explanation would be:
Let T be temporary variable.
T=4*x
T=T+6
T=T*x
T=T+9
T=T*x
T=T+34
Now T is the result of calculating the polynomial, and we used 3 additions and 3 multiplications.
Giant Kitten автор
Thank you for this comment. Your explanation is spot on. I was trying to explain it without expressions and failed as you pointed out.
Small Lizard
If a node having two children is deleted from a binary tree, it is replaced by its...
Your answer is inorder successor.
But why not to replace it with inorder predecessor? All tree structure will remain correct.
Giant Kitten автор
Thanks for the comment. I choose Inorder successor as it's the conventional way to do it. But I guess you pointed another way to achieve it. Sorry for the ambiguity.
Small Lizard
To convert a binary tree into its mirror image, traverse it in...
Your answer is postorder.
But postorder is just list of nodes. How to convert in into tree mirror image (which is tree)?
Giant Kitten автор
Sorry for the confusion. I meant to create a mirror tree. Mirror Tree of a binary tree is where left and right child of every node of given binary tree is interexchanged. And the answer should have been Pre order traversal. Thank you for the comment.
Small Lizard
A technique that can be used for a direct search is...
What is direct search?
Giant Kitten автор
Appreciate the comment. Sorry for the misleading approach. It was asking as to what uses direct access approach. Search algorithms that use hashing work by direct access based on key value. Hashing involves a hash function: a function that transforms the search key into an array index, and a collision-resolution process that deals with the cases where multiple keys are mapped to the same index.
Small Lizard
Which of the following data structure CANNOT store the non-homogenous data elements?
Your answer is arrays.
But how pointers can store the non-homogenous data elements?
Giant Kitten автор
Thanks for the comment. You are right. I guess pointers should not be among the choices.
Small Lizard
Which of the following algorithms would be ideal to sort a list that is alnost sorted?
Your answer is bubble sort.
But insertion sort is correct too.
Let's read https://en.wikipedia.org/wiki/Insertion_sort:
Adaptive, i.e., efficient for data sets that are already substantially sorted: the time complexity is O(kn) when each element in the input is no more than k places away from its sorted position
Giant Kitten автор
Thanks for the comment. Insertion sort could also be a viable choice.
Small Lizard
A binary tree in which if all the levels except possibly the last level have the maximum number of nodes and the nodes at last level exist on the left most region, this structure is...
Your answer is full binary tree.
But correct is complete binary tree.
Proof: https://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees
A full binary tree is a tree in which every node has either 0 or 2 children.
In a complete binary tree every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible.
Giant Kitten автор
Thanks for the comment. Sorry for the mistake. The correct answer is Complete Binary Tree as you pointed out.
Small Lizard
The number of leaf nodes in a complete binary tree of depth d is...
There are two correct options: "2^d" and "(2^d-1) + 1", they are equal. Maybe, you missed parentheses?
Giant Kitten автор
Thanks for the comment. Sorry for the missing parenthesis. It should be 2^(d-1)+1. And for a complete binary tree, the number of nodes
at depth d is 2^d.
Giant Kitten автор
Thanks for the concern. I prepared the quiz from notes and studies of mine from college. Maybe I can't prove about the originalality since I have prepared them from notes and excercises I have done long ago. But I don't think I violated copyrights. Furthermore, the sites mentioned above are discussion groups and forums where people submit questions from all over for clarification and answers. I might've used them in my time in college too. If you search any question in the Internet, you are bound to find some resembling results. Thank you:)
Щоб залишати коментарі, необхідно пройти тест