Skip to content
Snippets Groups Projects
Commit 870fbf57 authored by Tobias Koelling's avatar Tobias Koelling
Browse files

binary search reword

parent 8bb4b65f
No related branches found
No related tags found
1 merge request!24complexity lecture
...@@ -569,9 +569,10 @@ None ...@@ -569,9 +569,10 @@ None
## Hands-on Session! {background-color=var(--dark-bg-color) .leftalign} ## Hands-on Session! {background-color=var(--dark-bg-color) .leftalign}
1. Create an array `x_values` with at least 4000 equally distributed elements ranging from -2.0 to 2.0 1. Create an array `x_values` with at least 4000 equally distributed elements ranging from -2.0 to 2.0
2. Starting from the left end (-2.0), implement a binary search to find the highest value $x$ in the array `x_values`, 2. Implement a binary search.
for which $f(x) > 0$. How many steps and checks are necessary to find $x$? 3. Find the highest value $x$ in the array `x_values` for which $f(x) > 0$.
3. How many steps would be necessary if `x_values` contained 4100 values? And for 3900? 4. How many steps and checks are necessary to find $x$?
5. How many steps would be necessary if `x_values` contained 4100 values? And for 3900?
# Takeaway # Takeaway
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment