Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
aa:lab:6 [2025/11/07 23:41] stefan.sterea |
aa:lab:6 [2025/11/11 08:02] (current) stefan.sterea |
||
|---|---|---|---|
| Line 13: | Line 13: | ||
| if (x < arr[m]) { | if (x < arr[m]) { | ||
| - | return binary_search(arr, start, m, x); | + | return binary_search(arr, start, m - 1, x); |
| } else { | } else { | ||
| - | return binary_search(arr, m, end, x); | + | return binary_search(arr, m + 1, end, x); |
| } | } | ||
| } | } | ||
| Line 63: | Line 63: | ||
| * $ T(n) = 4 T(n/4) + 1 $ | * $ T(n) = 4 T(n/4) + 1 $ | ||
| * $ T(n) = 4 T(n/2) + n^2 $ | * $ T(n) = 4 T(n/2) + n^2 $ | ||
| - | * $ T(n) = \frac{8 T(2n/3)}{27} + n^3 \log^2 n + n^2 $ | + | * $ T(n) = \frac{27 T(2n/3)}{8} + n^3 \log^2 n + n^2 $ |
| * $ T(n) = 8 T(n/2) + 2n^4 $ | * $ T(n) = 8 T(n/2) + 2n^4 $ | ||
| * $ T(n) = 16 T(n/4) + n^3 \sqrt{n} $ | * $ T(n) = 16 T(n/4) + n^3 \sqrt{n} $ | ||