line breaks and indent
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user