What is the worst-case complexity of a search in a BST with N elements?
COMP 210 - Help for MDTM 2

Quiz
•
Computers
•
12th Grade
•
Easy
King Rylo
Used 11+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
O(log N) - elements cannot be inserted in a sorted order, which makes it non-linear
O(N) - elements can be inserted in a sorted order, which makes it linear
O(1) - elements can be inserted in a sorted order, which makes it deal with constant time
O(N^2) - elements cannot be inserted in a sorted order, which results in dealing with quadratic time.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the worst-case complexity of a search in a balanced BST with N elements?
O(log N) - It would be a binary search with near equal numbers being eliminated and kept at each step
O(log N) - it would not be a binary search with near equal numbers being eliminated and kept at each step
O(N) - it would be a binary search with near equal numbers being eliminated and not kept at each step
O(1) - it would not be a binary search, it would be constant
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the worst-case complexity of a search in a Heap with N elements?
O(N) - there is no other way to search for a specific element in a heap other than linear search
O(1) - there is no other way to search for a specific element in a heap other than constant search
O(log N) - there is no other way to search for a specific element in a heap other than logarithmic search
O(N^2) - there is no other way to search for a specific element in a heap other than quadratic search
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many leaves are there in a perfect binary tree of height h?
2^h
log base 2(h)
h! * 2
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given that a heap has N elements and uses an ArrayList data structure, what is the average complexity of the above operation. Justify based on each of the steps involved in the dequeue operation.
The average time complexity is O(log N). This is because dequeue has a step for each level of the tree the node must bubble down, possibly up to the entire height of the tree, or O(log N).
The average time complexity is O(N). This is because dequeue has a step for each level of the tree the node must bubble down, possibly up to the entire height of the tree, or O(N).
The average time complexity is O(1). This is because dequeue has a step for each level of the tree the node must bubble down, possibly up to the entire height of the tree, or O(1).
The average time complexity is O(log N). This is because dequeue has a step for each level of the tree the node must bubble up, possibly up to the entire height of the tree, or O(log N).
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following linked list implementation of a Queue class. Choose the code for the method 'Node<T> get(int i)' that returns the address of the i^th node (with i=0 being the node at the head of the queue), or returns a null if the i^th node does not exist.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the ArrayList implementation of a sorted List containing N items. What
would be the worst-case running time complexity, in Big-O notation, of the
following operations:
Inserting an item in the list (assuming the array does not have to be resized)?
O(N)
O(log N)
O(1)
O(N^2)
Create a free account and access millions of resources
Similar Resources on Quizizz
16 questions
Sorting & Searching Algorithms

Quiz
•
12th Grade
15 questions
SLR5 | Algorithms

Quiz
•
12th Grade
15 questions
FUNDAMENTALS OF ALGORITHMS - UNIT 3 MCQS

Quiz
•
12th Grade
17 questions
Networking Vocab

Quiz
•
9th - 12th Grade
15 questions
SOM - Comandos LINUX

Quiz
•
9th Grade - University
20 questions
Algorithm questions

Quiz
•
12th Grade - University
20 questions
ONE 6th FORM A* & Dijkstras and complexities

Quiz
•
12th Grade
16 questions
Y13 Big O notation

Quiz
•
10th Grade - University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University