Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
aa:lab:07 [2020/11/23 23:10] claudiu.dorobantu |
aa:lab:07 [2020/11/23 23:12] (current) claudiu.dorobantu |
||
---|---|---|---|
Line 57: | Line 57: | ||
return search(arr, mid, hi, v); | return search(arr, mid, hi, v); | ||
} | } | ||
- | | + | |
**2.1** Determine the recurrence for the search algorithm above. | **2.1** Determine the recurrence for the search algorithm above. | ||
Line 69: | Line 69: | ||
Consider the following modification to 'search' (which may not make sense in practice): | Consider the following modification to 'search' (which may not make sense in practice): | ||
- | | + | |
int search(int arr[], int lo, int hi, int v) | int search(int arr[], int lo, int hi, int v) | ||
{ | { | ||
Line 84: | Line 84: | ||
return search(arr, mid, hi, v); | return search(arr, mid, hi, v); | ||
} | } | ||
- | | + | |
**3.1** In what time can we check if an array is sorted? | **3.1** In what time can we check if an array is sorted? | ||
Line 102: | Line 102: | ||
**4.5** Consider the following algorithm: | **4.5** Consider the following algorithm: | ||
- | + | ||
int fibo(int n) | int fibo(int n) | ||
{ | { | ||
Line 109: | Line 109: | ||
return fibo(n - 1) + fibo(n - 2); | return fibo(n - 1) + fibo(n - 2); | ||
} | } | ||
- | + | ||
- | Determine its complexity with regard to the size of the input. | + | Determine its complexity with regard to the size of the input. |
**4.6** Solve $math[T(n) = \sqrt n * T(\sqrt n) + n]. | **4.6** Solve $math[T(n) = \sqrt n * T(\sqrt n) + n]. |