Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
aa:lab:05 [2020/11/09 10:06] roxana_elena.stiuca [3. Execution time vs. Asymptotic growth] |
aa:lab:05 [2020/11/15 13:11] (current) fabianpatras |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Lab 05 - Asymptotic notations ====== | + | ====== Lab 06 - Asymptotic notations ====== |
Line 12: | Line 12: | ||
==== 2. Properties of asymptotic notations ==== | ==== 2. Properties of asymptotic notations ==== | ||
- | **2.1** Prove that if $math[lim] $math[g(n) \over f(n)] $math[= 0] implies that $math[g(n) \in o(f(n))], for n reaching infinity. Hint: use the "epsilon" or "Cauchy" limit definition for sequences. | + | **2.1** Prove that if $math[lim_{n\rightarrow \infty}] $math[g(n) \over f(n)] $math[= 0] implies that $math[g(n) \in o(f(n))], for n reaching infinity. Hint: use the "epsilon" or "Cauchy" limit definition for sequences. |
**2.2** Prove that $math[f(n) \in Ω(log(n))] and $math[g(n) \in O(n)] implies $math[f(n) \in Ω(log(g(n)))]. | **2.2** Prove that $math[f(n) \in Ω(log(n))] and $math[g(n) \in O(n)] implies $math[f(n) \in Ω(log(g(n)))]. | ||
Line 87: | Line 87: | ||
The output of the script should be a list of values: | The output of the script should be a list of values: | ||
+ | <code> | ||
a b | a b | ||
+ | </code> | ||
- | where a is the **size of the input**, expressed as a natural number and b is the running time for gcd. | + | where ''a'' is the **size of the input**, expressed as a natural number and ''b'' is the running time for gcd. |
- | For instance, for x = 10000, b will be the running time of gcd, on the 10000th and 9999th fibonacci number. a will be the SIZE of the input, i.e. the number of bits required to store the value $math[fibo(x) + fibo(x+1)], rounded to a natural number. | + | For instance, for x = 10000, ''b'' will be the running time of gcd, on the 10000th and 9999th fibonacci number. ''a'' will be the **size** of the input, i.e. the number of bits required to store the value $math[fibo(x) + fibo(x+1)], rounded to a natural number. |
+ | |||
+ | **3.9** Write a gnuplot script to plot the data collected from the python script, and compare it to the **linear** function. Comment the results. How does the execution time grow? Find the suitable function. | ||
- | **3.9** Write a gnuplot script to plot the data collected from the python script, and compare it to the logarithmic function. Comment the results. How does the execution time grow? Find the suitable function. |