0% found this document useful (0 votes)
2 views1 page

Design and analysis of algorithms assignment Nov 24

The assignment involves analyzing the growth of various functions when their arguments are increased fourfold, identifying which functions are less affected by large inputs. It also covers the computation time for algorithms with specific time complexities and explores the properties of binary search trees, including their depth and runtime. Additionally, it presents a problem related to selecting gloves to ensure a matching pair is obtained in both best and worst-case scenarios.

Uploaded by

reginamakena05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Design and analysis of algorithms assignment Nov 24

The assignment involves analyzing the growth of various functions when their arguments are increased fourfold, identifying which functions are less affected by large inputs. It also covers the computation time for algorithms with specific time complexities and explores the properties of binary search trees, including their depth and runtime. Additionally, it presents a problem related to selecting gloves to ensure a matching pair is obtained in both best and worst-case scenarios.

Uploaded by

reginamakena05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Design and analysis of algorithms assignment

a. For each of the following functions which was used to monitor order of growth.
indicate how much the function’s value will change if it’s arguments is increased
fourfold, and indicate which one will not be affected much by large input and which
one will.
i. √𝑛
ii. n
iii. log 2 𝑛
iv. 𝑛2
b. Suppose tA = O (n2) and tB = θ (n2). Calculate the total computation time for the
following.

c. One of the common divide and conquer algorithms is Binary search using binary search
tree. The find, insert and delete algorithms start at the tree root and follow a path down
to, at worst case, the leaf at the very lowest level. The total number of steps of these
algorithms is, therefore, the largest level of the tree, which is called the depth (d) of the
tree.
i. Using an example, illustrate that the total number of nodes n for a full binary
tree with depth d is given by the equation: n= 2d+1 – 1
ii. Considering the formula n= 2d+1 – 1 above for the number of nodes in a
full binary search tree. Show that the runtime of the algorithms is O(lo
iii. Compute the cost/runtime of a full binary search tree of 16 nodes
d. There are 22 gloves in a drawer, 5 pairs of red gloves,4 pairs of yellow and 2 pair of
green. You select the gloves in the dark and can check them only after a selection has
been made. What is the smallest number of gloves you need to select to have at least
one matching pair in the best case and worst case?

You might also like