ANALYSIS on SEARCHING ALGORITHMS JASC: Journal Of

Total Page:16

File Type:pdf, Size:1020Kb

ANALYSIS on SEARCHING ALGORITHMS JASC: Journal Of JASC: Journal of Applied Science and Computations ISSN NO: 1076-5131 ANALYSIS ON SEARCHING ALGORITHMS N.Pavani, M.Sree Vyshnavi, K. Sindhu Reddy, Mr. C Kishor Kumar Reddy and Dr.B V Ramana Murthy. Stanley College of Engineering and Technology for Women, Hyderabad [email protected], [email protected], [email protected], [email protected], [email protected] ABSTRACT Searching algorithms are designed to check form an element and retrieve an element from array from any of data structure where it is stored. Various searching techniques are analyzed based on the time a space complexity. There are two types of searching, internal searching and external searching. The analysis shows the advantages and disadvantages of various searching algorithms. On analysis it is found out that binary search is suitable for mid-sized data items in arrays and linked list whereas hash search is best for the larger data items. Keywords: Algorithm, Searching, Internal and External Searching, Time complexity. 1. INTRODUCTION Searching is a technique which programmers are always passively solving. Not even asingle day pass by, when we do not have to search for something in our daily life. Whenever a user asks for some data, computer has to search its memory to look for that data and should make it available to the user. And the computer has its own techniques to search through its memory very fast. To search an element in a given array, there are few algorithms available here: ⦁ Linear Search ⦁ Exponential Search ⦁ Ternary Search ⦁ Binary Search ⦁ Interpolation Search ⦁ Hash Search Volume VI, Issue I, January/2019 Page No:654 JASC: Journal of Applied Science and Computations ISSN NO: 1076-5131 1.1. Complexity Analysis The Complexity analysis is used to determine algorithm which will take amount of resources (like time and space) are necessary to execute it. There are two types of complexities, they are: Time Complexity and Space Complexity. An analysis of the time is required to solve a problem of particular size involves the time complexity of the algorithm. An analysis of computer memory required, involves the space complexity of the algorithm. There are three types of time complexities--- Best, average and worst case. Asymptotic Notations are languages that allow us to analyze an algorithms run time by identifying its behavior as the input size for the algorithm increases which is also known as an algorithm’s growth rate. Big Oh is mostly used to describe worst-case of an algorithm. Big Omega is the opposite of Big Oh, big Omega is used to describe the lower bound of asymptotic function. When an algorithm has complexity with lower bound=upper bound, which means the running time of that algorithm always falls in n log n for best-case and worst-case which is Big Theta. 2. RELEVANT WORK Bentley discussed searching algorithms, its advantages and disadvantages. They analyzed the different searching algorithms and binary search for mid-sized lists. Thomas Niemann in his research worked on searching algorithms on basics of time, space complexities. Reema Thareja discussed about the hashing and the hash functions. Wein Mark Allen explained about the different searching techniques, implementation with few examples. Various Searching Algorithms are: 2.1. LINEAR SEARCH/SEQUENTIAL SEARCH Linear searching is one of the basic searching technique. This type of searching is used to search an element in sequential order. Therefore, it is also called a sequential search. The basic concept of search is comparing the elements in the array. If any element in the array is matched to the number we entered then the position of that number is printed (index).Linear search has a simple search algorithm. Performance of linear search, we have different cases: In the average case, the linear search takes n/2 comparisons and in the worst case, it takes 2n+1 comparison’s, where n is the number of elements in the set. 2.1.1. Algorithm Linear search is simple and the job of this technique is to keep comparing with all the elements present in the list. This can be easily understood from the below algorithm. Firstly we need to set the value of i to. If the initial value is greater than n, then go to step 7. If a[i]=x then go to step 6. Then the value of i gets incremented. After incrementing again go to step 2. If the required element is found print "The element is found". If the element is not found then print "The element is not found", Exit. Volume VI, Issue I, January/2019 Page No:655 JASC: Journal of Applied Science and Computations ISSN NO: 1076-5131 Figure.1: Image showing target value through linear search. 2.1.2. Analysis a) Worst case is the condition at which the target is not found in the list and the order is O(n). b) Best case is when the required target is found in the first position and the order is O(1). c) Average case is when a target is found after n comparisons and the order is O(n). 2.1.3. Advantages a) This kind of searching technique is simple to perform. b) If we find the element in the first increment then there is no need for us to know how many pages are there. c) This type of technique takes less time. d) It is independent of number of elements in the directory. e) The Time complexity of linear search is O(1). 2.1.4. Disadvantages a) It is not suitable for long lists. b) If the list is too long then we need to search each and every element in the list. c) The Worst time complexity of the linear search is O(n). Volume VI, Issue I, January/2019 Page No:656 JASC: Journal of Applied Science and Computations ISSN NO: 1076-5131 2.2. EXPONENTIAL SEARCH Exponential search which is also called doubling search or galloping search is an algorithm created by Jon Bentley and Andrew-chi-chih-yao in 1976, for searching or sorted unbounded/infinite lists. There are many ways to implement this with the most common being to determine the range that the search key resides in and performing a binary search within that range. This takes O (log i ) where i is the position of the search key in list, if search key is in the list, or in position where the search key should be. 2.2.1. Algorithm Exponential search allows searching through a sorted and an unbounded list for a specified input value “the search key". The algorithm consists of two stages. The first stage determines the range in which search key would reside if it was in the list. In the second stage, a binary search is performed on that range. In the first stage, assuming that list is sorted in an ascending order, the algorithm looks for the first exponent, j , where the value 2 j is greater than search key. Figure.2: Target value being searched by exponential search. In each step, the algorithm compares the search key value with the key value at current search index. If the element at current index is smaller than the search key, the algorithm repeats, skipping to next search index by doubling it, calculating the next power of 2. If the element at the current index is larger than the search key, the algorithm now knows that search key, if it is contained in the list is located in the interval formed by the previous search index, 2 j - 1 , and the current search index, 2 j . The binary search is then performed with the result of either a failure, if the search key is not in the list, or in the position of the search key in the list. 2.2.2. Time Complexity The first stage of the algorithm takes O (log i ) time, where i is index where the search key would be in list. This gives the algorithm a total runtime, calculated by summing runtimes of the two stages: O (log i) + O (log i ) = 2 O (log i ) = O (log i ). 2.2.3. Advantages a) It is easy to learn and apply. b) It produces accurate forecasts. Volume VI, Issue I, January/2019 Page No:657 JASC: Journal of Applied Science and Computations ISSN NO: 1076-5131 c) It gives more significance to recent observations. 2.2.4. Disadvantages a) It produces forecasts that lag behind the actual trend. b) It cannot handle trends well. 2.3. TERNARY SEARCH This concept is used in unimodal functions to determine maximum or minimum value of that function. Unimodal functions are functions that have single highest value. Like linear search and binary search, ternary search is also a searching technique that is used to determine position of a specific value in an array. In binary search, the sorted array is divided into two parts while in ternary search, it is divided into 3 parts and then you determine in which part the element exists. Like linear search and binary search, ternary search is also a searching technique that is used to determine the position of a specific value in an array. In binary search, the sorted array is divided into two parts while in ternary search, it is divided into parts and then you determine in which part element exists. Ternary search, like binary search, is a divide-and-conquer algorithm. A ternary search tree is a special trie data structure where the child nodes of a standard trie are ordered as a binary search tree. Representation of ternary search trees: Unlike trie(standard) data structure where each node contains 26 pointers for its children, each node in a ternary search tree contains only 3 pointers: a) The left pointer points to the node whose value is less than the value in the current node.
Recommended publications
  • Bubble Sort, Selection Sort, and Insertion Sort
    Data Structures & Algorithms Lecture 3 & 4: Searching and Sorting Algorithm Halabja University Collage of Science /Computer Science Department Karwan Mahdi [email protected] 2020-2021 Objectives Introduction to Search Algorithms which is consist of Linear Search and Binary Search Understand the significance of sorting Distinguish between internal and external sorting Understand the logic behind the simple sorting methods of bubble sort, selection sort, and insertion sort. Introduction to Search Algorithms Search: locate an item in a list of information. Two common algorithms (methods): • Linear search • Binary search Linear search: also called sequential search. Examines all values in an array until it finds a match or reaches the end. • Number of visits for a linear search of an array of n elements: • The average search visits n/2 elements • The maximum visits is n • A linear search locates a value in an array in O(n) steps Example for linear search Example: linear search Algorithm of Linear Search Order in linear search Advantages and Disadvantages • Benefits: • Easy algorithm to understand • Array can be in any order • Disadvantages: • Inefficient (slow): for array of N elements, examines N/2 elements on average for value in array, • N elements for value not in array “Java code for linear search REQUIRE” Binary Search Binary search is a smart algorithm that is much more efficient than the linear search ,the elements in the array must be sorted in order 1. Divides the array into three sections: • middle element • elements on one side of the middle element • elements on the other side of the middle element 2.
    [Show full text]
  • Binary Search Algorithm This Article Is About Searching a Finite Sorted Array
    Binary search algorithm This article is about searching a finite sorted array. For searching continuous function values, see bisection method. This article may require cleanup to meet Wikipedia's quality standards. No cleanup reason has been specified. Please help improve this article if you can. (April 2011) Binary search algorithm Class Search algorithm Data structure Array Worst case performance O (log n ) Best case performance O (1) Average case performance O (log n ) Worst case space complexity O (1) In computer science, a binary search or half-interval search algorithm finds the position of a specified input value (the search "key") within an array sorted by key value.[1][2] For binary search, the array should be arranged in ascending or descending order. In each step, the algorithm compares the search key value with the key value of the middle element of the array. If the keys match, then a matching element has been found and its index, or position, is returned. Otherwise, if the search key is less than the middle element's key, then the algorithm repeats its action on the sub-array to the left of the middle element or, if the search key is greater, on the sub-array to the right. If the remaining array to be searched is empty, then the key cannot be found in the array and a special "not found" indication is returned. A binary search halves the number of items to check with each iteration, so locating an item (or determining its absence) takes logarithmic time. A binary search is a dichotomic divide and conquer search algorithm.
    [Show full text]
  • Binary Search Algorithm Anthony Lin¹* Et Al
    WikiJournal of Science, 2019, 2(1):5 doi: 10.15347/wjs/2019.005 Encyclopedic Review Article Binary search algorithm Anthony Lin¹* et al. Abstract In In computer science, binary search, also known as half-interval search,[1] logarithmic search,[2] or binary chop,[3] is a search algorithm that finds a position of a target value within a sorted array.[4] Binary search compares the target value to an element in the middle of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found. If the search ends with the remaining half being empty, the target is not in the array. Binary search runs in logarithmic time in the worst case, making 푂(log 푛) comparisons, where 푛 is the number of elements in the array, the 푂 is ‘Big O’ notation, and 푙표푔 is the logarithm.[5] Binary search is faster than linear search except for small arrays. However, the array must be sorted first to be able to apply binary search. There are spe- cialized data structures designed for fast searching, such as hash tables, that can be searched more efficiently than binary search. However, binary search can be used to solve a wider range of problems, such as finding the next- smallest or next-largest element in the array relative to the target even if it is absent from the array. There are numerous variations of binary search.
    [Show full text]
  • Unit 5 Searching and Sorting Algorithms
    Sri vidya college of engineering and technology course material UNIT 5 SEARCHING AND SORTING ALGORITHMS INTRODUCTION TO SEARCHING ALGORITHMS 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. Some of the standard searching technique that is being followed in data structure is listed below: 1. Linear Search 2. Binary Search LINEAR SEARCH Linear search is a very basic and simple search algorithm. In Linear search, we search an element or value in a given array by traversing the array from the starting, till the desired element or value is found. It compares the element to be searched with all the elements present in the array and when the element is matched successfully, it returns the index of the element in the array, else it return -1. Linear Search is applied on unsorted or unordered lists, when there are fewer elements in a list. For Example, Linear Search 10 14 19 26 27 31 33 35 42 44 = 33 Algorithm Linear Search ( Array A, Value x) Step 1: Set i to 1 Step 2: if i > n then go to step 7 Step 3: if A[i] = x then go to step 6 Step 4: Set i to i + 1 Step 5: Go to Step 2 EC 8393/Fundamentals of data structures in C unit 5 Step 6: Print Element x Found at index i and go to step 8 Step 7: Print element not found Step 8: Exit Pseudocode procedure linear_search (list, value) for each item in the list if match item == value return the item‟s location end if end for end procedure Features of Linear Search Algorithm 1.
    [Show full text]
  • Performance Enhancements in Large Scale Storage Systems
    This document is downloaded from DR‑NTU (https://dr.ntu.edu.sg) Nanyang Technological University, Singapore. Performance enhancements in large scale storage systems Rajesh Vellore Arumugam 2015 Rajesh Vellore Arumugam. (2015). Performance enhancements in large scale storage systems. Doctoral thesis, Nanyang Technological University, Singapore. https://hdl.handle.net/10356/65630 https://doi.org/10.32657/10356/65630 Downloaded on 28 Sep 2021 07:25:14 SGT PERFORMANCE PERFORMANCE ENHANCEMENTS IN LARGE LARGE SCALE STORAGE SYSTEMS PERFORMANCE ENHANCEMENTS IN LARGE SCALE STORAGE SYSTEMS RAJESH ARUMUGAM RAJESH RAJESH VELLORE ARUMUGAM SCHOOL OF COMPUTER ENGINEERING 2015 2015 PERFORMANCE ENHANCEMENTS IN LARGE SCALE STORAGE SYSTEMS RAJESH VELLORE ARUMUGAM School Of Computer Engineering A thesis submitted to the Nanyang Technological University in partial fulfilment of the requirement for the degree of Doctor of Philosophy 2015 Acknowledgements I would like to thank my supervisors Asst. Prof. Wen Yonggang, Assoc. Prof. Dusit Niyato and Asst. Prof. Foh Chuan Heng for their guidance, valuable and critical feedback throughout the course of my investigations and research work. I am also grateful to Prof. Wen Yongang for guiding me in writing this thesis and some of the conference papers which were outcome of this research work. His valuable inputs have improved the quality of the writing and technical content significantly. The major part of the thesis are the outcome of the Future Data Center Technologies thematic research program (FDCT TSRP) funded by the A*STAR Science and Engineering Research Council. I am grateful to all my friends/colleagues in A*STAR Data Storage Institute who provided me the guidance and support in executing the project (titled ‘Large Scale Hybrid Storage System’) to a successful completion.
    [Show full text]
  • Searching & Sorting
    Searching & Sorting Dr. Chris Bourke Department of Computer Science & Engineering University of Nebraska|Lincoln Lincoln, NE 68588, USA http://cse.unl.edu/~cbourke [email protected] 2015/04/29 12:14:51 These are lecture notes used in CSCE 155 and CSCE 156 (Computer Science I & II) at the University of Nebraska|Lincoln. Contents 1. Overview5 1.1. CSCE 155E Outline..............................5 1.2. CSCE 156 Outline..............................5 I. Searching6 2. Introduction6 3. Linear Search6 3.1. Pseudocode..................................7 3.2. Example....................................7 3.3. Analysis....................................7 4. Binary Search7 4.1. Pseudocode: Recursive............................8 4.2. Pseudocode: Iterative.............................9 4.3. Example....................................9 4.4. Analysis....................................9 1 5. Searching in Java 11 5.1. Linear Search................................. 11 5.2. Binary Search................................. 11 5.2.1. Preventing Arithmetic Errors.................... 12 5.3. Searching in Java: Doing It Right...................... 13 5.4. Examples................................... 13 6. Searching in C 14 6.1. Linear Search................................. 14 6.2. Binary Search................................. 15 6.3. Searching in C: Doing it Right........................ 16 6.3.1. Linear Search............................. 16 6.3.2. Binary Search............................. 16 6.4. Examples................................... 17 II. Sorting
    [Show full text]
  • Data Structure and Algorithm (Lecture
    1 DATA STRUCTURE AND ALGORITHM Dr. Khine Thin Zar Professor Computer Engineering and Information Technology Dept. Yangon Technological University 2 Lecture 9 Searching 3 Outlines of Class (Lecture 9) Introduction Searching Unsorted and Sorted Arrays Sequential Search/ Linear Search Algorithm Binary Search Algorithm Quadratic Binary Search Algorithm Self-Organizing Lists Bit Vectors for Representing Sets Hashing 4 Introduction Searching is the most frequently performed of all computing tasks. is an attempt to find the record within a collection of records that has a particular key value a collection L of n records of the form (k1; I1); (k2; I2);...; (kn; In) Ij is information associated with key kj from record j for 1 j n. the search problem is to locate a record (kj ; Ij) in L such that kj = K (if one exists). Searching is a systematic method for locating the record (or records) with key value kj = K . 5 Introduction (Cont.) Successful Search a record with key kj = K is found Unsuccessful Search no record with kj = K is found (no such record exists) Exact-match query is a search for the record whose key value matches a specified key value. Range query is a search for all records whose key value falls within a specified range of key values. 6 Introduction (Cont.) Categories of search algorithms : Sequential and list methods Direct access by key value (hashing) Tree indexing methods 7 Searching Unsorted and Sorted Arrays Sequential Search/ Linear Search Algorithm Jump Search Algorithm Exponential Search Algorithm Binary Search Algorithm Quadratic Binary Search (QBS) Algorithm 8 Searching Unsorted and Sorted Arrays (Cont.) Sequential search on an unsorted list requires (n) time in the worst case.
    [Show full text]
  • Fast and Vectorizable Alternative to Binary Search in O (1) Applicable To
    A Fast and Vectorizable Alternative to Binary Search in O(1) with Wide Applicability to Arrays of Floating Point Numbers Fabio Cannizzo∗ Abstract Given an array X of N + 1 strictly ordered floating point numbers1 and a floating point number z belonging to the interval [X0, XN ), a common problem in numerical methods is to find the index i of the interval [Xi, Xi+1) containing z, i.e. the index of the largest number in the array X which is smaller or equal than z. This problem arises for instance in the context of spline interpolation or the computation of empirical probability distribution from empirical data. Often it needs to be solved for a large number of different values z and the same array X, which makes it worth investing resources upfront in pre-processing the array X with the goal of speeding up subsequent search operations. In some cases the values z to be processed are known simultaneously in blocks of size M, which offers the opportunity to solve the problem vectorially, exploiting the parallel capabilities of modern CPUs. The common solution is to sequentially invoke M times the well known binary search algorithm, which has complexity O(log2N) per individual search and, in its classic formulation, is not vectorizable, i.e. it is not SIMD friendly. This paper describes technical improvements to the binary search algorithm, which make it faster and vectorizable. Next it proposes a new vectorizable algorithm, based on an indexing technique, applicable to a wide family of X partitions, which solves the problem with complexity O(1) per individual search at the cost of introducing an initial overhead to compute the index and requiring extra memory for its storage.
    [Show full text]
  • Modified Binary Search Algorithm
    International Journal of Applied Information Systems (IJAIS) – ISSN : 2249-0868 Foundation of Computer Science FCS, New York, USA Volume 7– No. 2, April 2014 – www.ijais.org Modified Binary Search Algorithm Ankit R. Chadha Rishikesh Misal Tanaya Mokashi Dept. of Electronics & Department of Computer Department of Computer Telecommunication Engg. Engineering. Engineering. Vidyalankar Institute of Vidyalankar Institute of Vidyalankar Institute of Technology Technology Technology Mumbai, India Mumbai, India Mumbai, India st ABSTRACT present in the 1 and last position of the intermediate array at This paper proposes a modification to the traditional binary every iteration. Modified binary search is also optimized for search algorithm in which it checks the presence of the input the case when the input element does not exist which is out of range amongst the range present in the array that is, if the element with the middle element of the given set of elements st at each iteration. Modified binary search algorithm optimizes input number is less the 1 element or it is greater than the last the worst case of the binary search algorithm by comparing element it certainly does not exist the given set of elements. the input element with the first & last element of the data set Since it checks the lower index and higher index element in along with the middle element and also checks the input the same pass, it takes less number of passes to take a decision number belongs to the range of numbers present in the given whether the element is present or not. data set at each iteration there by reducing the time taken by the worst cases of binary search algorithm.
    [Show full text]
  • Concise Notes on Data Structures and Algorithms
    Concise Notes on Data Structures and Algorithms Ruby Edition Christopher Fox James Madison University 2011 Contents 1 IntroductIon 1 What Are Data Structures and Algorithms? . 1 Structure of the Book . 3 The Ruby Programming Language . 3 Review Questions . 3 Exercises . 4 Review Question Answers . 4 2 BuIlt-In types 5 Simple and Structured Types . 5 Types in Ruby . 5 Symbol: A Simple Type in Ruby . 5 Review Questions . 9 Exercises . 9 Review Question Answers . 9 3 ArrAys 10 Introduction . 10 Varieties of Arrays . 10 Arrays in Ruby . 11 Review Questions . 12 Exercises . 12 Review Question Answers . 13 4 AssertIons 14 Introduction . 14 Types of Assertions . 14 Assertions and Abstract Data Types . 15 Using Assertions . 15 Assertions in Ruby . 16 Review Questions . 17 Exercises . 17 Review Question Answers . 19 5 containers 20 Introduction . 20 Varieties of Containers . 20 1 Contents A Container Taxonomy . 20 Interfaces in Ruby . 21 Exercises . 22 Review Question Answers . 23 6 stAcks 24 Introduction . 24 The Stack ADT . 24 The Stack Interface . 25 Using Stacks—An Example . 25 Contiguous Implementation of the Stack ADT . 26 Linked Implementation of the Stack ADT . 27 Summary and Conclusion . 28 Review Questions . 28 Exercises . 29 Review Question Answers . 29 7 Queues 31 Introduction . 31 The Queue ADT . 31 The Queue Interface . 31 Using Queues—An Example . 32 Contiguous Implementation of the Queue ADT . 32 Linked Implementation of the Queue ADT . 34 Summary and Conclusion . 35 Review Questions . 35 Exercises . 35 Review Question Answers . 36 8 stAcks And recursIon 37 Introduction . 37 Balanced Brackets . 38 Infix, Prefix, and Postfix Expressions . 39 Tail Recursive Algorithms .
    [Show full text]
  • Searching and Sorting
    Chapter 7 Searching and Sorting There are basically two aspects of computer programming. One is data organization also commonly called as data structures. Till now we have seen about data structures and the techniques and algorithms used to access them. The other part of computer programming involves choosing the appropriate algorithm to solve the problem. Data structures and algorithms are linked each other. After developing programming techniques to represent information, it is logical to proceed to manipulate it. This chapter introduces this important aspect of problem solving. Searching is used to find the location where an element is available. There are two types of search techniques. They are: 1. Linear or sequential search 2. Binary search Sorting allows an efficient arrangement of elements within a given data structure. It is a way in which the elements are organized systematically for some purpose. For example, a dictionary in which words is arranged in alphabetical order and telephone director in which the subscriber names are listed in alphabetical order. There are many sorting techniques out of which we study the following. 1. Bubble sort 2. Quick sort 3. Selection sort and 4. Heap sort There are two types of sorting techniques: 1. Internal sorting 2. External sorting If all the elements to be sorted are present in the main memory then such sorting is called internal sorting on the other hand, if some of the elements to be sorted are kept on the secondary storage, it is called external sorting. Here we study only internal sorting techniques. 7.1. Linear Search: This is the simplest of all searching techniques.
    [Show full text]
  • A Survey on Different Searching Algorithms
    International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 07 Issue: 01 | Jan 2020 www.irjet.net p-ISSN: 2395-0072 A Survey on Different Searching Algorithms Ahmad Shoaib Zia1 1M.Tech scholar at the Department of Computer Science, Sharda University Greater Noida, India ---------------------------------------------------------------------***--------------------------------------------------------------------- Abstract - This paper presents the review of certain b) Internal searching: [3] Internal searching is that important and well discussed traditional search algorithms type of searching technique in which there is fewer with respect to their time complexity, space Complexity , amounts of data which entirely resides within the with the help of their realize applications. This paper also computer’s main memory. In this technique data highlights their working principles. There are different resides within the main memory on. types of algorithms and techniques for performing different tasks and as well as same tasks, with each having its own advantages and disadvantages depending on the 2. Exiting Search Algorithms type of data structure. An analysis is being carried out on 2.1 Binary Search different searching techniques on parameters like space and time complexity. Dependent upon the analysis, a It is a fast search algorithm [9] as the run-time complexity is comparative study is being made so that the user can Ο (log n). Using Divide and conquer Principle for it search choose the type of technique used based on the algorithm. This algorithm performs better for sorted data requirement. collection. In binary search, we first compare the key with the item in the middle position of the data collection. If there is a match, we can return immediately.
    [Show full text]