3. Is a functions which we use to
measure
Time,Space,and Check Efficiency of
the any Algorithms(Data Structure).
4. There are three cases to measure the
algorithm in linear search
Best case
Average case
Worst case
5. Linear search is a technique in which
Items can be find sequentially or one by
one from data element.
Find 55 number
x=n+1
Start
11 12 33 44 55 65
0 1 2 3 4 5 6 7
6. The term best-case performance is used to
best case for a simple linear search on a
list occurs when the desired element is
the first element of the list.
For example
Find 11 c(n)=1
11 22 33 44 55 66 77 88
7. Expected value of function
Find 76 c(n)=1/n
Start
Item not found
23 45 55 67 69 76 80 90
0 1 2 3 4 5 6 7
8. Expected value of function
Find 76 c(n)=1/n
Start
Item not found
23 45 55 67 69 76 80 90
0 1 2 3 4 5 6 7
9. Expected value of function
Find 76 c(n)=1/n
Start
Item not found
23 45 55 67 69 76 80 90
0 1 2 3 4 5 6 7
10. Expected value of function
Find 76 c(n)=1/n
Start
Item not found
23 45 55 67 69 76 80 90
0 1 2 3 4 5 6 7
11. Expected value of function
Find 76 c(n)=1/n
Start
Item not found
23 45 55 67 69 76 80 90
0 1 2 3 4 5 6 7
12. Expected value of function
Find 76 c(n)=1/n
Start
Item found x={5}=76
23 45 55 67 69 76 80 90
0 1 2 3 4 5 6 7
13. Binary search is a searching technique can be
search by the dividing the array of data
element from the Mid portion
Formula= Mid int(Beg + End)/2
BEG MID END
0 1 2 3 4 5 6 7
10 11 12 23 24 35 36 45
14. Find the number 37 from this array?
X=37
Divided by Mid
Now formula=int (mid + end)/2
int (0+8)/2=4
0 1 2 3 4 5 6 7 8
10 37 12 23 24 35 36 45 88
15. There are three cases to measure the
algorithm in linear search
Best case
Average case
Worst case