Comparison Searching Process of Linear, Binary and Interpolation Algorithm
Comparison Searching Process of Linear, Binary and Interpolation Algorithm
Recent citations
- Textbook Design on Temperature and
Thermodynamic Based on Problem
Solving Blended Learning Model
Agus Rohman and Trise Nurul Ain
Abstract. Searching is a process that cannot be issued for a transaction and communication
process, many search algorithms that can be used to facilitate the search, linear, binary, and
interpolation algorithms are some searching algorithms that can be utilized, the comparison of
the three algorithms is performed by testing to search data with different length with pseudo
process approach, and the result achieved that the interpolation algorithm is slightly faster than
the other two algorithms.
1. Introduction
Searching is a process that is usually performed in everyday activities, the search process is usually done
to look for something with the purpose only to know whether the data is in a set of data or not [1] [2]
[3], while at other times we may want the position of the data sought [3] [4] [5].
In computer science, there are various algorithms for search methods, such as the linear search
method (Linear/Sequential Search), binary search and interpolation search [6]. Each algorithm has
different prerequisites and different ways and execution time [6] [7]. The choice of search method meant
on the user's circumstances, and the desire of the method which usually depends on the amount of data,
data type and data structure used [8] [9].
This research tried to compare linear, binary and interpolation search algorithms with pseudo process
approach for a gradual testing process.
2. Theory
Searching is a process with the aim to know whether the data is in a set of data or not, or maybe at other
times the position of the data sought is needed for a particular purpose [1] [2] [3], or if the appearance
of data more than once then all positions and frequency of appearance to be displayed [1] [2] [10], The
simplest search can be described as follows [1]:
Content from this work may be used under the terms of the Creative Commons Attribution 3.0 licence. Any further distribution
of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.
Published under licence by IOP Publishing Ltd 1
International Conference on Information and Communication Technology (IconICT) IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 1234567890
930 (2017) 012007 doi:10.1088/1742-6596/930/1/012007
Suppose a sequence of data X [1] ... X [n], then the problem is whether Y (any data with the same
data type as the existing data type in the X sequence and usually in input or already known) X [1] ... X
[n] or whether Y is inside or not with Boolean result true / false or success / fail.
In computer science there are many algorithms for search method; generally, the data search methods
split into several sections [4] such as:
1. Linear search method.
2. Binary search method.
3. Interpolation search method.
Each search algorithm has different prerequisites and ways and time of implementation, the selection of
search methods is based on the circumstances, and desires of the user of the method which usually
depends on the amount of data, data type and data structure used [8].
If the data in that position is equal to the value of data sought (X), then the search is stopped and
declared successful [10]. Whereas if the value of data in the position of suspected is not equal to the
value of data sought (X) [2] [10], then:
1. For ascending data, if the value of the data sought (X) is smaller than the data value in the suspected
position, then the search is continued by changing the upper boundary of the search area. Whereas
2
International Conference on Information and Communication Technology (IconICT) IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 1234567890
930 (2017) 012007 doi:10.1088/1742-6596/930/1/012007
if the data value sought (X) is greater than the value of data in the suspected position, then the search
is continued by changing the lower boundary of the search area.
For descending data, if the value of the data sought (X) is greater than the value of the data in the
suspected position, then the search is continued by changing the upper boundary of the search area.
Whereas if the data value sought (X) is smaller than the data value in the suspected position, then the
search is continued by changing the lower boundary of the search area.
F = True
Data '4' Found!
The process of searching data with the pseudo-linear process has been performed, following test search
data with the binary algorithm, the result as below:
Data: 2, 4, 5, 8, 10, 13, 15, 17, 19, 32, 35, 65
X = Data searched
N = Amount of data
3
International Conference on Information and Communication Technology (IconICT) IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 1234567890
930 (2017) 012007 doi:10.1088/1742-6596/930/1/012007
Found = True
Data '4' Found!
4
International Conference on Information and Communication Technology (IconICT) IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 1234567890
930 (2017) 012007 doi:10.1088/1742-6596/930/1/012007
While (1 <= 12) And Not (False) -> True, Search resumed.
Temp = BB + ((X - A (BB)) / (A (BA) - A (BB))) * (BA - BB)
Temp = 1 + ((4 - 2) / (65 - 2)) * (12 - 1) = 1.349206
Pos = Int (Temp) = Int (1.349206) = 1
If (1.349206 - 1 > 0) -> True
Pos = Pos + 1 = 1 + 1 = 2
If (0 = 2) -> False
(4 = 4) -> True
Found = True
Found = True
Data '4' found!
The last process of the interpolation search has been completed, from the above three search algorithm
process using same length of data and same value, based on the pseudo process of each algorithm and
by re-testing for longer lengths get the result as follows:
Based on the above process with a search of different lengths results obtained under the interpolation
search algorithm more quickly than linear and binary algorithms
Experiment was perform using Python programming because have a stable memory and large memory
cache so that the experiment process can be done as objective as possible.
5
International Conference on Information and Communication Technology (IconICT) IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 1234567890
930 (2017) 012007 doi:10.1088/1742-6596/930/1/012007
4. Conclusion
The comparison of linear, binary and interpolation search algorithms is made by testing with data lengths
of 500, 1000 and 2000, based on the authors experiment it appears that the interpolation search algorithm
is faster than the other two algorithms, the results of this test are not absolute for all cases that can be
implemented, but this test using pseudo code approach process with random data that the author did and
re-examined until a couple of times by using a program created by the Python language, the results that
interpolation search algorithm faster
References
[1] S. Pushpa and P. Vinod, "Binary Search Tree Balancing Methods: A Critical Study," International
Journal of Computer Science and Network Security, vol. 7, no. 8, pp. 237-243, 2007.
[2] J. z. Li and H. K. Wong, "Batched Interpolation Searching on databases," in IEEE Third
International Conference on Data Engineering, Los Angeles, CA, USA, USA, 1987.
[3] S. Kareem B, "Matrix Search Algorithm Using Binary Search Trees," Research & Reviews:
Journal of Engineering and Technology, vol. 5, no. 2, pp. 1-6, 2016.
[4] N. Arora, G. Bhasin and N. Sharma, "Two way Linear Search Algorithm," International Journal
of Computer Applications, vol. 107, no. 21, pp. 6-8, 2014.
[5] B. G. Balogun and J. S. Sadiku, "Simulating Binary Search Technique Using Different Sorting
Algorithms," International Journal of Applied Science and Technology , vol. 3, no. 6, pp. 67-
75, 2013.
[6] K. K. Pandey and N. Pradhan, "A Comparison and Selection on Basic Type of Searching
Algorithm in Data Structure," International Journal of Computer Science and Mobile
Computing, vol. 3, no. 7, pp. 751-758, 2014.
[7] V. P.Parmar and CK Kumbharana, "Comparing Linear Search and Binary Search Algorithms to
Search an Element from a Linear List Implemented through Static Array, Dynamic Array and
Linked List," International Journal of Computer Applications, vol. 121, no. 3, pp. 13-17,
2015.
[8] A. Mehta, A. Saxena, J. Patel and A. Thanna, "A REVIEW ON COMPARISION OF BINARY
SEARCH AND LINEAR SEARCH," International Journal of Engineering Sciences &
Management Research, vol. 2, no. 10, pp. 85-89, 2015.
[9] Y. Perl and L. Gabriel, "Arithmetic interpolation search for alphabet tables," IEEE Transactions
on Computers, vol. 41, no. 4, pp. 493 - 499, 1992.
[10] G. MARSAGLIA and B. NARASIMHAN , "Simulating Interpolation Search," Computers
Mathematics Application, vol. 26, no. 8, pp. 31-42, 1993.