下面 C++ 代码用于有序 list 的二分查找,有关说法错误的是( )。
int _binarySearch(vector<int>lst, int Low, int High,int Target)
{
if (Low > High)
return -1;
int Mid = (Low + High) / 2;
if (Target == lst[Mid])
return Mid;
else if (Target < lst[Mid])
return _binarySearch(lst, Low, Mid - 1, Target);
else
return _binarySearch(lst, Mid + 1, High, Target);
}
int bSearch(vector<int>lst, int Val)
{
return _binarySearch(lst, 0, lst.size(), Val);
}