Update 01_binary_search.cpp (#271)
use template to the item that we are search for
This commit is contained in:
@@ -5,7 +5,7 @@ using std::cout;
|
||||
using std::endl;
|
||||
|
||||
template <typename T>
|
||||
int binary_search(const std::vector<T>& list, const int& item) {
|
||||
int binary_search(const std::vector<T>& list, const T& item) {
|
||||
int low = 0;
|
||||
int high = list.size() - 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user