You are on page 1of 13

ShrikriShna Educational and cultural mundal’S

Shri GulaBrao Deokar Polytechnic.


Gat no.26, mohadishivar, shirsoli road, Jalgaon-425001
Micro Project Report on :-
“Develope a project to demonstrate SEARCHING TECHNIQUES”

Is Submitted as per III scheme curriculum and the requirement for the
program :- Diploma in Computer Engg.

Course :- DSU

Group Members RoLL


1. Patil pranav yogesh. 17
2. Nale Ayush yogesh. 18
3. Patil lina vinayak. 19
4. Koli Vaishali pundlik . 20

Guided by :- prof. Ms. M.V.Yeole.


ShrikriShna Educational and cultural mundal’S
Shri GulaBrao Deokar Polytechnic.
Gat no.26, mohadishivar, shirsoli road, Jalgaon-425001
Academic Year 2023-2024.

Certificate
This is to certify the students:-

1) patil pranav yogesh


2) Nale Ayush yogesh
3) Patil lina vinayak
4) koli Vaishali pundlik

Have successfully presented the micro project on “Develop a project to


demonstrate SEARCHING TECHNIQUES” And submitted in satisfactory manner.

The micro project is submitted in partial full fillment for the second year(Third
Scheme) diploma in Computer Engineering, affiliated to Maharashtra State Board
of Technical Education, for Academic Year
2023-2024.

Prof.Ms.M.V.Yeole Prof. Ms. M.V. Yeole. Mr.Sandip patil


( Guide) ( H.O.D ) (principal)
Index

TOPICS PAGE NO.


SR.NO.
1) introduction 4
2) Algorithm for linear search 5-6
3) program 6-8
4) flowchart 9
5) Algorithm for binary search 9-10
6) program 10-11
7) flowchart 12
INTRODUCTION
There are various types of searching techniques, including linear search,
binary search, hash search, and tree search. Linear search is a simple
and straightforward method for finding data, while binary search is
faster for larger sets of data.
Searching is an operation or a technique that helps finds the place
of a given element or value in the list. Any search is said to be
successful or unsuccessful depending upon whether the element
that is being searched is found or not.
ALGORITHM FOR LINEAR SEARCH

Every element is considered as a potential match for the key and checked
for the same.
If any element is found equal to the key, the search is successful and the
index of that element is returned.
If no element is found equal to the key, the search yields “No match found”.
For example: Consider the array arr[] = {10, 50, 30, 70, 80, 20, 90, 40} and
key = 30

Step 1: Start from the first element (index 0) and compare key with each
element (arr[i]).

Comparing key with first element arr[0]. SInce not equal, the iterator
moves to the next element as a potential match.

Compare key with arr[0]


Compare key with arr[0]

Comparing key with next element arr[1]. SInce not equal, the iterator
moves to the next element as a potential match.
Compare key with arr[1]
Compare key with arr[1]

Step 2: Now when comparing arr[2] with key, the value matches. So the
Linear Search Algorithm will yield a successful message and return the
index of the element when key is found (here 2).

Compare key with arr[2]


Compare key with arr[2]

PROGRAM

\\program to implement linear search


#include<stdio.h>
void main(){
int a[5],i,item,n=5;

printf("\nEnter 5 numbers ");


for(i=0;i<n;i++)
scanf("%d",&a[i]);

printf("\nEnter the number to search ");


scanf("%d",&item);
i=0;
while(i<n){
if(a[i]==item){
printf("\n%d is found at %d position ",item, i);
break;
}
i++;
}
if(i==n)
printf("\n%d is not found in array ",item);
}

OUTPUT :
FLOWCHART :
ALGORITHM FOR BINARY SEARCH
step 1: start

step 2: [initialize variable]

Set beg=lb, end-ub, loc=0

step 3: Repeat steps4, 5 and 6 until

beg<= end and data[mid] != item

step 4: [find middle]

mid=(beg+end)/2

step 5: [compare data[mid] and item]

if data [mid] == item the set loc=mid

End if

step 6 :[jump in respective half]

if item >data[mid] then

beg= mid +1

else

end= mid-1

step 7: if loc==0 then

Print "item is not else”

Else

Print "item is found at loc"

step 8: Stop

PROGRAM
\\program to implement binary search

#include<stdio.h>

void main()

int a[10],n=10,item,i,beg,end,mid;

printf("\nEnter 10 numbers in sorted order ");

for(i=0;i<n;i++)

scanf("%d",&a[i]);

printf("\nEnter the number to search ");

scanf("%d",&item);

beg=0;

end=n-1;

while(beg<=end)

mid = (beg+end)/2;

if(a[mid]==item){

printf("\n%d is found at %d position",item,mid);

break;

}
if(item<a[mid])

end=mid-1;

else

beg=mid+1;

if(beg>end)

printf("\n%d is not found ",item);

}//end of main

OUTPUT :

FLOWCHART

You might also like