Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve in Python: Uh-Notation. (Task 2.1) i. Prove that f(n) = (g(n)) holds if g(n) = O(f(n)) using the definition from the front page. Prove

Solve in Python:

image text in transcribed

Uh-Notation. (Task 2.1) i. Prove that f(n) = (g(n)) holds if g(n) = O(f(n)) using the definition from the front page. Prove your answers. ii. Is f(n) +g(n) = (max(f(n) + g(n))? (Assume that f and g are nonnegative functions.) iii. Is (n + 100)5 = O(nb)? iv. Is 300 log(nk) + kk + 2Vk log k = O(n logn + 2k log k)? b) Analyzing Algorithms. (Task 2.2) i. Write an algorithm for the function Swap(a,i,l) that exchanges the values at position i and l in the array a, that is, after calling Swap(a,i,l), a[i] contains the former value at a[e], and a[l] contains the former value at a[i]. ii. Modify Strange Algo(n, k) to run in time (nk). (c) Designing Algorithms.Task 2.3) Design an algorithm that outputs the binary representation of a nonnegative integer x, which is a binary array a[O..n] (i.e. containing only 0 and 1) where n= log xsuch that = a[0] . 2 + a[1] . 2 + ... + a[n]. 2". Thus, a[i] is the i-th bit of x. You are only allowed to use the following arithmetic opera- tions: +,-,*,/ where / is the integer division defined as a/b = Loj. - Page 3

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_2

Step: 3

blur-text-image_3

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago