Professional Documents
Culture Documents
Dsu Microproject Final1
Dsu Microproject Final1
Dsu Microproject Final1
SANJIVANI K. B. P. POLYTECHNIC
DEPARTMENT OF COMPUTER TECHNOLOGY
CERTIFICATE
This is to certify that the project report entitled
“TYPES OF SEARCHING IN C”
Submitted By
Under our supervision and guidance for partial fulfillment of the requirement for
Diploma in Computer Technology affiliated to
Maharashtra State Board of Technical Education, Mumbai
For academic year
2022-2023
CERTIFICATE
This is to certify that the project report entitled
2022 -2023
ACKNOWLEDGMENT
We would take this opportunity to express our sincere thanks and gratitude to our Project Guide Prof.
V.A.Parjane Department of Computer Technology, Sanjivani K.B.P.Polytechnic, Kopargaon. For his vital
guidance and support in completing this project. Lots of thanks to the Head of Computer technology
Department Mr. G.N. Jorvekar for providing us with the best support we ever had. We like to express our
sincere gratitude to Mr. A. R. Mirikar, Principal, Sanjivani K. B. P. Polytechnic, Kopargaon for
providing a great platform to complete the project within the scheduled time. Last but not the least; we would
like to say thanks to our family and friends for their never-ending love, help, and support in so many ways
through all this time. A big thanks to all who have willingly helped us out with their ability.
2. TYPES OF SEARCHES
9. SOURCES
10. CONCLUSION
INDEX
WHAT IS SEARCHING IN C ?
Searching in data structure refers to the process of finding location LOC of an element in a list. This is
one of the important parts of many data structures algorithms, as one operation can be performed on an
element if and only if we find it. Various algorithms have been defined to find whether an element is
present in the collection of items or not. This algorithm can be executed on both internal as well as
external data structures.
In computer science, a search algorithm is an algorithm designed to solve a search problem. Search
algorithms work to retrieve information stored within particular data structure, or calculated in the search
space of a problem domain, with either discrete or continuous values. algorithms are
Visual representation of a hash table, a data structure that allows for fast retrieval of information.
Although search engines use search algorithms, they belong to the study of information retrieval, not
algorithmics.
The appropriate search algorithm often depends on the data structure being searched, and may also
include prior knowledge about the data. Search algorithms can be made faster or more efficient by
specially constructed database structures, such as search trees, hash maps, and database indexes.[1][full
citation needed][2]
TYPES OF SEARCHING
1. BINARY SEARCH
2. LINEAR SEARCH
WHAT IS BINARY SEARCH?
Binary Search is used with sorted array or list. In binary search, we
follow the following steps:
his is a technique to search an element in the list using the divide and conquer
technique. This type of technique is used in the case of sorted lists. Instead of
searching an element one by one in the list, it directly goes to the middle
element of the list, divides the array into 2 parts, and decides element lies in
increasing order. With every step of this algorithm, the searching is confined
within BEG and END, which are the beginning and ending index of sub-arrays.
The index MID defines the middle index of the array where,
It needs to be checked if ITEM < ARR[N} where ITEM is the element that we
● If ITEM < ARR[MID} then ITEM can appear in the left sub-array, then BEG
● If ITEM > ARR[MID] then ITEM can appear in the right subarray then BEG
LOC =APPLICATION
MID. OF BINARY SEARCH
➢ This algorithm is used to search element in a given sorted array with more efficiency.
➢ It could also be used for few other additional operations like- to find the smallest element in
the array or to find the largest element in the array.
➢ Semiconductor test programs used for measuring digital timing or analog levels make extensive
use of binary search.
ALGORITHM
BSEARCH(ARR, LB, UB, ITEM, LOC) Here, ARR is a sorted list of elements, with
LB and UB are lower and upper bounds for the array. ITEM needs to be
searched in the array and algorithm returns location LOC, index at which ITEM
2. Repeat step 3 and 4 while BEG <= END and ARR[MID] != ITEM
Else:
6. Exit.
ARR[MID] = 52
Step 1: ARR[MID] < ITEM : thus END =9 and BEG = MID +1 = 6. Thus our new
sub-array is,
Step 2: Now BEG =6 and END =9 thus MID = INT([6+9]/2)= 6
Thus LOC = 6
On the other hand, if the element is not found, then it returns a NULL
value.
of elements. In this type of search, all the elements of the list are
traversed one by one to find if the element is present in the list or not.
elements, and we need to find location LOC of element ITEM in ARR. For
this, LOC is assigned to -1, which indicates that ITEM is not present in
ARR. While comparing ITEM with data at each ARR location, and once
The applications of linear equations are vast and are applicable in numerous real-
life situations. To handle real-life situations using algebra, we change the given
situation into mathematical statements. So that it clearly illustrates the relationship
between the unknown variables and the known information. The following are the
steps involved to reiterate a situation into a mathematical statement,
➢ Convert the real problem into a mathematical statement and frame it
in the form of an algebraic expression that clearly defines the problem
situation.
➢ Identify the unknowns in the situation and assign variables of these
unknown quantities.
➢ Read the situation clearly a number of times and cite the data,
phrases, and keywords. Sequentially organize the obtained
information.
➢ Write an equation using the algebraic expression and the provided
data in the statement and solve it using systematic equation solving
techniques
➢ Reframe the solution to the problem statement and analyze if it exactly
suits the problem.
Using these steps, the applications of word problems can be solved easily.
ALGORITHM
elements, ITEM holds the value we need to search in the array and
algorithm returns LOC, the location where ITEM is present in the ARR.
i=i+1
4. Exit.
Let’s say, below is the ARR with 10 elements. And we need to find whether
Time Complexity
● Best case complexity: O(1) – This case occurs when the first element is
Conclusion
Searching refers to finding the location of one element in the array of n
elements. There are 2 types of search linear and binary Search, Linear search
only be used in case of the sorted list of elements. In case the size of the array
Source
• www.javatpoint.com
• www.geeksforgeeks.org