Professional Documents
Culture Documents
Computer Science & Engineering: Department of
Computer Science & Engineering: Department of
Computer Science & Engineering: Department of
a) Linear Search
b) Binary Search (only Sorted)
2. Source Code:
#include <iostream>
void
int s = 0;
int e = size;
while (e > s)
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
int mid = (s + e) / 2;
if (a[mid] == key)
pos = mid;
chck = 1;
break;
e = mid;
else
s = mid;
if (chck == 1)
cout << "Element found at index " << pos << endl;
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
else
void
int pos;
bool chck;
if (a[i] == key)
chck = true;
else
chck = false;
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
if (chck = false)
int
main ()
int n;
cin >> n;
int a[n];
} int key;
int ch;
switch (ch)
case 1:
break;
case 2:
break;
case 3:
exit (1);
goto ABC;
return 0;
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
3. Result/Output
Evaluation Grid :
1. Student Performance 12
(Conduct of experiment)
objectives/Outcomes.
2. Viva Voce 10
3. Submission of Work 8
Sheet (Record)
Total 30