Question: UL 2 0 / 0 0 3 2 ALGORITHM 1 function A 1 ( root , x ) Q = new Queue ( ) ENQUEUE
ULALGORITHM
function root
new Queue
ENQUEUE Q root
while ISEMPTYQ do
PEEK
if
return TRUE
else
ENQUeUeleft
right
DEQUEUE Q
end while
return FALSE
end function
Note: the function ENQUEUE only inserts
a new element in the queue if this element
is different from NULL
See the image reference two algorithms.
Here are the questions:
see the image
see the image
c What is the task performed by algorithms A and A Dont forget to
mention the return values for the different cases
d What is the worstcase time complexity of A Use Theta notation and
explain your reasoning
e Assuming a fully balanced BST a BST with all its levels fully populated of N
elements, what is the recurrence equation describing the running time of A
f What is the worstcase time complexity of A Use Theta notation and
show your workings
g Which algorithm do you recommend to implement? Why?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
