Comparison Between Linear Search and Bynary Search Algorithms
Comparison Between Linear Search and Bynary Search Algorithms
ABSTRACT
We are living in the age of technology. In this age of technology many engineers and researchers are comparing our
existing technologies and working on new technologies. Software engineering is the most important branch of
computer science. In computer science, a search algorithm is an algorithm used to solve the search problem and to
retrieve information stored within some data structure. The main objective of this paper is to study linear search and
binary search algorithm and to compare them on the basis of their time complexity.
Keywords:- Searching, linear search, binary search, linked list, time complexity, static array, dynamic array, search
algorithms.
1.Introduction
A search algorithm is the step by step procedure used to locate specific data among the collections of data. Searching is
considered as the most fundamental procedure in computer science. When the data is to be searched, the difference
between a fast application and a slower one lies in the use of proper search algorithms.
All search algorithms make use of a search key in order to proceed with the procedure. Search algorithms are expected to
return a success or a failure status, usually denoted by the Boolean true or false. Different search algorithms are available
and the performance and the efficiency of them depend on the data and on the manner on which they are used.
Search cases in search algorithm can be categorized as best case, average case, and worst case. In some algorithms all
three cases can be same but in some algorithms their might be big difference between all of them. The average behavior
of the search algorithm helps in determining the usefulness of the algorithm.
Categories of searching
a. External searching: External searching is the searching algorithm that can handle large amount of data. The
requirement of external search comes when the data being searched do not fit into the main memory of a
computing device (usually RAM) and instead they must reside in the slower external memory, usually a hard
drive.
b. Internal searching: The internal searching is any data searching process that takes place entirely within the main
memory of the computer. This is possible whenever the data is to be searched is small enough to all be held in the
main memory.
2.Description
a. Linear search: Linear search is most simplest method of searching. It is also known as sequential search, it is
named so because linear search searches element from array or linked list by testing each of the element one by
one and comparing it with the search element starting from left to right. it means it is the method where search
starts at the end of the list, scans the element of the list from left to right until the desired element is found. This
searching is used for searching the records that are stored without considering the order.
b. Binary search: Binary search is also known as half interval search, logarithmic search, or binary chop. it is more
efficient then linear search because it searches the element in minimum number of comparison. Binary search
compares the target element from the middle of the element of array; if it is not found then half in which target
cannot lie is eliminated and the search continues in the remaining half until the desired target is found. if the
search ends with the remaining other half empty, it means the target element is not in the array.
4.Conclusion
From the above research it is concluded that the linear search is more simpler than binary search because linear search
searches element from array or linked list by testing each of the element one by one and compare it with the search
element starting from left to right but the binary search compares the target element from the middle of the element of
array; if it is not found then half in which target cannot lie is eliminated and the search continues in the remaining half
until the desired target is found. But the binary search is more efficient than the linear search because it takes less amount
of comparisons to find target element as compare to linear search. But the insertion of elements in binary search is not
more efficient because it requires arranged elements in specific order.
5.Acknowledgement
I would like to thank my guide who gave me an opportunity to share my views regarding searching. This paper will
definitely give them a detail knowledge about the searching .
6.References:
[1]. A Comparative Analysis of Three Different Types of Searching Algorithms in Data Structure.(Debadrita
Roy)volume 3, 5may2014.
[2]. ANALYSIS AND COMPARATIVE STUDY OF SEARCHING TECHNIQUES(Ayush Pathak)Acropolis
Institute of Technology & Research, Indore ,India.
[3]. Comparing Linear Search and Binary Search Algorithms to Search an Element from a Linear List Implemented
Through Static Array, Dynamic Array & Linked List(Vimal P Parmar, CK Kumbhakarna) Department of
computer science, Saurashtra University, Rajkot, Gujrat,India’