Update 01_binary_search.cpp (#271)

use template to the item that we are search for
This commit is contained in:
Mahmoud Hamdy
2024-12-07 15:45:03 +02:00
committed by GitHub
parent 00b28478ce
commit c06ad954f0

View File

@@ -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;