Final Practice

Quiz
•
Computers
•
University
•
Medium
Remo Mahmoud
Used 4+ times
FREE Resource
7 questions
Show all answers
1.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider a binary tree T in which every node has either zero or two children. Let n be the number of nodes in T. Which one of the following is the number of nodes in T that have exactly two children?
3.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
Select all that apply to the following tree:
Binary search tree
Full complete binary tree
Heap
Proper binary tree
Complete binary tree
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the most accurate time complexity in the worst case scenario in terms of big-O notation for searching for an entry in a multi-way search tree with n nodes.
O(logn)
O(n)
O(nlogn)
O(1)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A meld operation on two instances of a data structure combines them into one single instance of the same data structure. Consider the following data structures:
A. Unsorted doubly linked list.
B. Sorted doubly linked list
C. Min-heap implemented using an array.
Which one of the following options gives the worst-case time complexities for the meld operation on two instances of combined size n for each of these data structures?
A. O(1)
B. O(n)
C. O(n)
A. O(1)
B. O(n^2)
C. O(nlogn)
A. O(n)
B. O(n^2)
C. O(n)
A. O(1)
B. O(n)
C. O(nlogn)
6.
OPEN ENDED QUESTION
3 mins • 1 pt
Draw the resulting (2,4) tree after removing 2 (since you can't actually draw here, simply draw your solution on scratch paper, type anything here, then check your solution with the correct answer).
Evaluate responses using AI:
OFF
Answer explanation
This is one of two possible solutions. The other solution looks similar except the node with 4 in it has 3 and the node with 1 3 in it has 1 and the node with 5 in it has 4 5
7.
OPEN ENDED QUESTION
3 mins • 1 pt
Write the code for the mergeSort(S) algorithm which takes an vector S of integers and returns a sorted vector Q. Assume the merge(S1, S2, S) method (which takes two sorted vectors S1 and S2 and returns a merged sorted vector S) is already implemented and you can just use it.
Evaluate responses using AI:
OFF
Answer explanation
Vector mergeSort(S) {
if (S.size() <= 1) return S;
Vector S1, S2;
Vector::Iterator p = S.begin();
for (int i = 0; i < S.size()/2; i++)
S1.insertBack(*p++);
for (int i = n/2; i < n; i++)
S2.insertBack(*p++);
mergeSort(S1);
mergeSort(S2);
merge(S1, S2, S);
return S;
}
Similar Resources on Wayground
6 questions
Complexity Analysis Station [4]

Quiz
•
University
11 questions
Trees

Quiz
•
University
7 questions
Quiz AVL's Tree

Quiz
•
University
6 questions
MPS INTERNAL 2 TEST

Quiz
•
University
10 questions
Quiz - CSE

Quiz
•
University
10 questions
ALDA - Week 03

Quiz
•
University
10 questions
Data Structures Quiz

Quiz
•
University
10 questions
Trees

Quiz
•
University
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade