Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: There are bonus points listed for some questions, but you do not need to complete all other questions before attempting the bonus questions. Problem

Note: There are bonus points listed for some questions, but you do not need to complete all other questions before attempting the bonus questions.
Problem 1(40 pts).
(a)(10 pts) Prove that f = O(g) if and only if g =52(f). Note that you have to prove both directions.
(b)(10 pts) Using induction, prove that n!= O(n").
(c)(20 pts) Let a constant k 0 be given. Suppose that for any n and x, we are given functions pown, x) which calculates n*(e.g. with divide-and-conquer), and log(n, x) which calculates log,(x), both of which operate in O(log
n) time.
(i)(15 pts) Calculate a tight bound for the runtime of the following function f, and argue that your runtime is correct.
(ii)(5 pts) Briefly describe a simple way we can improve the runtime of this algorithm, and what the
improvement is.
1: function f(n)
i =1
x =0
while i < n do
in
i *= pow(n,1/k)
j=0
7:
8:
whilej < log(n, i) do x+=j
j+=1
10: returnx

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions