Ofn Find a simple function fn such that the following pseudo

O(f(n))
Find a simple function f(n) such that the following pseudocode runs in time O(f(n)): s leftarrow 0 t leftarrow 1 i leftarrow 0 for i from 3^n + n to 3^n + n^3 j leftarrow 0 do s leftarrow 2s + 9j - i t leftarrow it + 3^j j leftarrow j + 3 until e^j > ln n end for

Solution

do until loop runs infinitely. and the checking condition 3j>ln n, will always be true. So time complexity cannot be defined.

O(f(n)) Find a simple function f(n) such that the following pseudocode runs in time O(f(n)): s leftarrow 0 t leftarrow 1 i leftarrow 0 for i from 3^n + n to 3^n

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site