Confidential Teaching Materials:
Quiz 8 Grading Criteria, Page 1 of 3
Quiz 8 Grading Criteria
Note: To receive any credit whatsoever, the date, your name, your student number, and your answers must
be legible and readily readable in the judgment of the grader.
Add brief explanatory comments as necessary to make sure your answers are clear and unambiguous
to the grader.
[p1] 70 points
For each part of this question you are to give the Big-O of the given algorithms, along with an explanation of your
answer. You must provide an explanation in order to receive credit. On questions which refer to an “ordered”
data structure, assume the data is in descending order.
a) Searching for a value in an ordered array of size N
LINES=7
b) Finding the largest value in an ordered linked list of size N
LINES=7
c) Performing a Mergesort on an array of N elements
LINES=7
d) Finding the smallest value in a full and balanced binary search tree
LINES=7
e) Inserting a node into an ordered linked list of size N. The linked list must still be ordered after the insertion.
LINES=7
f) Searching for the smallest value in a full and balanced binary tree of ordered linked lists. Both the binary tree
and linked lists are of size N.
LINES=7
g) Find the Big-O of the following procedure
procedure Lots_O_Loops(m, n, p isoftype in Num)
i isoftype num
i <- 0
loop
exitif(m = 0)
loop
exitif(i = p)
loop
exitif(n = 0)
n <- n – 1
endloop
i <- i + 1
endloop
m <- m – 1
endloop
endprocedure // Lots_O_Loops
LINES=7