--------------------------------------------------------------------------------------------------------------------------
Prepared By : Uday Shah - HOD (IT)
Contact No : 7600044051
E-Mail : rupareleducation@gmail.com
Searching Technique
1.
Searching is a mechanism in which the large amount of
data are sorted in a local buffer as well as in server database and user want
to search individually then database allow to satisfy the criteria or condition
which individual record to retrieved from the database.
2.
So, the efficient storage of the data facility provides
fast searching algorithm technique.
3.
Searching of the data is the fundamental requirement of
any computer application.
4.
The main advantages of the searching algorithms is to
provide a good communication way by which user can retrieve a single or group
of records from thousand of records.
5.
Datastructure provide two fundamental searching techniques.
1. Liner
Search
2. Binary
Search
Linear Search
1. This is a simplest and easiest implementation of most
frequently used searching algorithm.
2. The Linear search is also most effective searching
algorithm because in this technique it simply traversal from top to bottom in
an array and compare each element of an array with their searching elements.
3.
If searching element is found in the list then it
display appropriate message on the screen otherwise it continues to find a
searching element up to the end of the list.
4.
In Linear search searching algorithm has one flag type
variable.
5.
If searching element found in the list then it change
the value of flag type variable.
6.
It will take more time in compare to others searching
algorithm.
7.
It is only used in limited amount of data because it
require more consuming time
8.
This is the simplest technique to find out an element
from an unsorted list. It simply traverse from top to bottom in the array and
find for the key target value from the list and display output as well. It will
also call as sequential searching method.
9.
In this technique the value of the key is compared with
the first element of the list, if match is found then the appropriate message
is displayed and searching is done on
remaining array elements.
linear Search
1. Start
2. Linear_Search(element, n, l)
Where
element represents an Array
List
n represents Number of Elements
l represents
Last Elements of an Array
3. Initialize:
k
= 0
Flag
= 1
4.
Repeat Step – 5 for k = 0, 1, 2 .. n -1
5.
if array[k] =
element
output: Element
Found
flag
= 0
return
6. if
flag = 1 then
output : Element Not Found
7. Exit
Binary Search
1.
Binary search is also one of the fundamental algorithms
to provide efficient searching algorithm.
2.
Sequential search use in a small amount of data while
binary search used in large amount of data because it user divide and conquer
method.
3.
Binary search is widely use searching algorithm for any
application because within a sort amount of time it produces thousands of
output on a special keyword.
4.
Binary search is a fastest searching algorithm.
5.
The main characteristics of binary search are that work
on sorted data list.
6.
In a binary search there are 3 different values are use
that is
a.
Low Value
b.
High Value
c.
Mid Value
7.
The Low value represent the lower limit of an array
which is always 0.
8.
The High value represents the Upper limit of an array
which is always SIZE – 1.
9.
The Mid value represents the average value of High
value and Low value.
10.
According to Binary Search algorithm searching element
compare with mid value.
11.
If searching element is higher then mid value then the
searching element is down side of mid value otherwise up side of the mid value
and this process is still continue up to the searching element is not found.
12.
This is an effective searching algorithm because within
a short period of time it displays the position of searching element in the
list.
Binary Search
1. Start
2. Binary_Search(element, n, l)
Where
element represents an Array
List
n represents Number of Elements
l represents
Last Elements of an Array
3. Initialize:
low = 0,high = n-1
4. Repeat through Step – 6 while (low
<= high)
5. mid = (low + high)/2
6. if
element < mid then
high
= mid – 1
else
if element > mid then
low
= mid + 1
else
if element = mid then
output:
Element Found
flag
= 0
return
7.
if flag = 1 then
output : Element Not Found
8. Exit