Find the Logical Errors in given program. #include using namespace std; int Search(int L[],int size, int SearchKey)
Fantastic news! We've Found the answer you've been seeking!
Question:
Find the Logical Errors in given program.
#include
using namespace std;
int Search(int L[],int size, int SearchKey)
{
int Result = -1;
int Left = 0;
int Right = size - 1;
while (Left < Right)
{
int Mid = (Left + Right) / 2;
if (L[Mid] >SearchKey)
{
Right = Mid - 1;
}
else if (L[Mid] { Left = Mid + 1; } else { Result = Mid; } } return Result; }
Related Book For
College Mathematics for Business Economics Life Sciences and Social Sciences
ISBN: 978-0321614001
12th edition
Authors: Raymond A. Barnett, Michael R. Ziegler, Karl E. Byleen
Posted Date: