line breaks and indent

This commit is contained in:
Jidong Xiao
2023-10-08 17:31:34 -04:00
parent 28b886ba8a
commit 0c2fafc28d

View File

@@ -1,7 +1,8 @@
# Lecture 12 --- Advanced Recursion
Review Recursion vs. Iteration
Binary Search
- Binary Search
- “Rules” for writing recursive functions
- Advanced Recursion — problems that cannot be easily solved using iteration (for or while loops):
Merge sort
@@ -38,7 +39,8 @@ bool binsearch(const std::vector<T> &v, int low, int high, const T &x) {
return binsearch(v, low, mid, x);
else
return binsearch(v, mid+1, high, x);
}
}
template <class T>
bool binsearch(const std::vector<T> &v, const T &x) {
return binsearch(v, 0, v.size()-1, x);