Binary Search A binary search algorithm finds the position of a specified value within a sorted array. Binary search is a technique for searching an ordered.

Slides:



Advertisements
Similar presentations
College of Information Technology & Design
Advertisements

Searching for Data Relationship between searching and sorting Simple linear searching Linear searching of sorted data Searching for string or numeric data.
Logical Operations on Images Boolean logic is a system of logical operations defined by George Boole in the mid 19th century to apply algebraic operations.
High Boost filtering In image processing, it is often desirable to emphasize high frequency components representing the image details without eliminating.
Ver. 1.0 Session 5 Data Structures and Algorithms Objectives In this session, you will learn to: Sort data by using quick sort Sort data by using merge.
Objectives Learn how to implement the sequential search algorithm Explore how to sort an array using the selection sort algorithm Learn how to implement.
Searching Arrays Linear search Binary search small arrays
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 9 Searching.
Hamming Code A Hamming code is a linear error-correcting code named after its inventor, Richard Hamming. Hamming codes can detect up to two bit errors,
Syndrome Decoding of Linear Block Code
Binary Exponential Backoff Binary exponential backoff refers to a collision resolution mechanism used in random access MAC protocols. This algorithm is.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 8: Searching and Sorting Arrays.
Copyright © 2012 Pearson Education, Inc. Chapter 8: Searching and Sorting Arrays.
Data Structures & Algorithms CHAPTER 4 Searching Ms. Manal Al-Asmari.
CS 162 Intro to Programming II Searching 1. Data is stored in various structures – Typically it is organized on the type of data – Optimized for retrieval.
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Searching Course Lecture Slides 28 May 2010 “ Some things Man was never.
Searching. Linear (Sequential) Search Search an array or list by checking items one at a time. Linear search is usually very simple to implement, and.
LAB#7. Insertion sort In the outer for loop, out starts at 1 and moves right. It marks the leftmost unsorted data. In the inner while loop, in starts.
CSC 211 Data Structures Lecture 13
Welcome This is a document to explains the chosen concept to the animator. This will take you through a 5 section process to provide the necessary details.
Chapter 9 slide 1 Introduction to Search Algorithms Search: locate an item in a list (array, vector, table, etc.) of information Two algorithms (methods):
Searching & Sorting Programming 2. Searching Searching is the process of determining if a target item is present in a list of items, and locating it A.
Logic Gates Part – III : Combinational Logic Gates Combinational Logic Circuits are made up from basic logic NAND, NOR or NOT gates that are "combined"
Chapter 9 Sorting. The efficiency of data handling can often be increased if the data are sorted according to some criteria of order. The first step is.
Course Code #IDCGRF001-A 5.1: Searching and sorting concepts Programming Techniques.
1. Searching The basic characteristics of any searching algorithm is that searching should be efficient, it should have less number of computations involved.
Line Coding Schemes ‏Line coding is the process of converting binary data, a sequence of bits to a digital signal. Authors Phani Swathi Chitta Mentor Prof.
Convolutional Coding In telecommunication, a convolutional code is a type of error- correcting code in which m-bit information symbol to be encoded is.
Edge Detection using Laplacian of Gaussian Edge detection is a fundamental tool in image processing and computer vision. It identifies points in a digital.
CSMA/CA Simulation  Course Name: Networking Level(UG/PG): UG  Author(s) : Amitendu Panja, Veedhi Desai  Mentor: Aruna Adil *The contents in this ppt.
Welcome This is a document to explains the chosen concept to the animator. This will take you through a 5 section process to provide the necessary details.
Gaussian Smoothing Gaussian Smoothing is the result of blurring an image by a Gaussian function. It is also known as Gaussian blur.  Course Name: Digital.
CSMA/CD Simulation Carrier Sense Multiple Access (CSMA), although more efficient than ALOHA or slotted ALOHA, still has one glaring inefficiency: When.
Linear Search Linear Search is a fundamental search algorithm. Linear search, also known as sequential search, is a process that checks every element in.
Median Filtering In signal processing, it is often desirable to be able to perform some kind of noise reduction on an image or signal. The median filter.
 Introduction to Search Algorithms  Linear Search  Binary Search 9-2.
Go-Back-N ARQ (Sliding Window Protocol) Go-Back-N is an instance of the Automatic Repeat-request (ARQ) Protocol, in which the sending process continues.
Document that explains the chosen concept to the animator 1.
CMPT 120 Topic: Searching – Part 2 and Intro to Time Complexity (Algorithm Analysis)
Process Scheduling In multiprogramming systems, when there is more than one ready process, the operating system must decide which one to activate. The.
1 compares each element of the array with the search key. works well for small arrays or for unsorted arrays works for any table slow can put more commonly.
Welcome This is a document to explains the chosen concept to the animator. This will take you through a 5 section process to provide the necessary details.
Searching Arrays Linear search Binary search small arrays
Searching and Sorting Arrays
Document that explains the chosen concept to the animator
COP 3503 FALL 2012 Shayan Javed Lecture 15
Introduction to Search Algorithms
Introduction to Search Algorithms
Learning Objectives After interacting with this Learning Object, the learner will be able to: Explain the process of collision detection in CSMA/CD.
Document that explains the chosen concept to the animator
Prof. Saravanan Vijayakumaran
Searching and Sorting Arrays
MSIS 655 Advanced Business Applications Programming
Standard Version of Starting Out with C++, 4th Edition
Welcome 1 This is a document to explains the chosen concept to the animator. This will take you through a 5 section process to provide the necessary details.
Dilation The basic morphological operations applied to either grayscale or binary images are Erosion and Dilation. Erosion shrinks image objects while.
Closing One of the important morphological operations applied to either grayscale or binary images is Closing. It is derived from the fundamental operations.
Erosion The basic morphological operations applied to either grayscale or binary images are Erosion and Dilation. Erosion shrinks image objects while.
Virtual Memory Virtual memory is a technique which gives an application program the impression that it has contiguous working memory, while in fact it.
Sorted Linked List A linked list is a data structure that consists of a sequence of data records such that in each record there is a field that contains.
Prof. Saravanan Vijayakumaran
Discrete Convolution of Two Signals
Data Structures and Algorithm: SEARCHING TECHNIQUES
Continuous Time Convolution
Searching and Sorting Arrays
Welcome 1 This is a document to explains the chosen concept to the animator. This will take you through a 5 section process to provide the necessary details.
Principles of Computing – UFCFA3-30-1
Party Problem The simplest example of Ramsey theory. It is also known as the ‘Maximum Clique Problem’. A clique of a graph is a complete sub graph of the.
Opening One of the important morphological operations applied to either grayscale or binary images is Opening. It is derived from the fundamental operations.
Image Sharpening using Laplacian
Presentation transcript:

Binary Search A binary search algorithm finds the position of a specified value within a sorted array. Binary search is a technique for searching an ordered list in which middle item is checked first and - based on that comparison – half of the data is discarded. The same procedure is then applied to the remaining half until a match is found or there are no more items left. Course Name: Design and Analysis of Algorithms Level(UG/PG): UG Author : Phani Swathi Chitta Mentor : Aruna Adil *The contents in this ppt are licensed under Creative Commons Attribution-NonCommercial-ShareAlike 2.5 India license

Learning Objectives After interacting with this Learning Object, the learner will be able to: Explain how to find an element in an array using “Binary Search”

1 2 3 4 5 Definitions of the components/Keywords: Binary Search is also called half-interval search algorithm. The binary search is best suitable search algorithm for searching a particular value in sorted arrays. Every iteration eliminates half of the remaining possibilities because the array is sorted. This makes binary searches very efficient - even for large arrays. Desired element / Item / Search value: An element that is being searched for in the array. 2 3 4 5 3

1 2 3 4 5 Definitions of the components/Keywords: Process to find the desired element using Binary search: Length of the array is defined. Get the middle element -----> floor[(start + end)/2] start: Index of the first element end: Index of the last element If the middle element equals to the searched value, the algorithm stops; otherwise, two cases are possible: If searched value is less than the middle element, restrict the search to the first half (start to mid -1) of the list If searched value is greater than the middle element, restrict the search to the second half (mid + 1 to end) of the list Repeat steps 2 and 3 until searched element is found or sub array has no elements. This implies element is not found in the array 2 3 4 5

1 2 3 4 5 Definitions of the components/Keywords: Algorithm to implement binary search: int binarySearch(int arr[ ], int value, int start, int end) {       while (start <= end)             int middle = floor(start + end) / 2;             if (arr[middle] == value)                   return middle;             else if (arr[middle] > value)                   end = middle - 1;             else                   start = middle + 1;       }       return key_not_found; } 1 2 3 4 5

1 2 3 4 5 Definitions of the components/Keywords: The advantage of binary search is its speed of finding the desired element in large arrays when compared to sequential search. The main limitation of binary search is that it can be done only on sorted arrays. The complexity of any searching method is determined from the number of comparisons performed among the elements of the list in order to find the element. The time required for a search operation depends on the complexity of the searching algorithm. The complexity of the binary search algorithm is O(log n). 2 3 4 5

Master Layout 1 Give START, PAUSE and STOP buttons Give 2 radio buttons Element found Element not found Give a STEPPER button that allows the user to follow the simulation procedure step by step. After every step the simulation pauses until the STEPPER button is pressed Give a text area to display the status of the simulation Give a slider bar to control the speed of animation Simulation Area Index 2 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 3 Array or list Fig. A 4 Current Indices: Give the value of the Indices i, j and mid at that particular time Legend: Array Desired element Desired element Match Current Index 5 ** For animator: All digits written in white in the array are “elements” or “values at index n “(n refers to index number ex. value at index 4 = 14).

3 Step 1: 1 2 4 5 Case – 1 (Element Found) i=0 j=7 1 2 3 4 5 6 7 8 14 1 2 3 4 5 6 7 start 8 14 21 25 48 52 60 76 end 2 3 start: i=0 end: j=7 mid: FLOOR ([0+7]/2) = 3 Legend: Array Desired element Desired element Match Current Index 21 Search Value: 4 Instruction for the animator Text to be displayed in the working area (DT) When the user clicks start, show the figure in master layout without labeling. Display array with its values inside and numbers above it. Also show the search value till the animation is over. Then show the text and arrows in red as shown in figure. Show the violet box with values of start, end and calculation of mid value The text in DT should appear in parallel to the figure Array of 8 elements with indices The search value: 21 Initialize start: i=0 and end : j=7 Compare i and j -- i<= j - 0<=7 TRUE Finding middle element mid = FLOOR([start +end]/2) 5

Step 2: 1 i=0 mid=3 j=7 1 2 3 4 5 6 7 start 8 14 21 25 48 52 60 76 end 2 21 Comparing 21 and 25 3 start: i=0 end: j=7 mid: 3 Legend: Array Desired element Desired element Match Current Index 21 Search Value: 4 Instruction for the animator Text to be displayed in the working area (DT) Show the text and arrow for mid as shown in figure. Then blink the orange box and blue box to which mid arrow is pointing to. While blinking, a text box saying “ Comparing 21 and 25” must appear. If the values in those 2 boxes doesn’t match, then see whether the number in orange box is greater or less than the number in blue box If less then display the only blue boxes before mid Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure mid = FLOOR ([0+7]/2) = 3 The desired element to search for in the array is 21 21 is compared with the element at mid 21 ≠ 25 and 21 < 25 Therefore the search for element 21 is done only in the first half . 5

Step 3: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 i=0 j=2 2 1 2 start: i=0 end: j= mid -1 = 3-1= 2 mid: FLOOR ([0+2]/2) = 1 start 8 14 21 end 3 21 Search Value: Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Display array with its values inside and numbers above it. Then show the text and arrows in red as shown in figure. Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure Compare i and j -- i<= j - 0<=2 TRUE Finding middle element mid = FLOOR([start +end]/2) 5

Step 4: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 i=0 mid=1 j=2 start: i=0 end: j=2 mid: 1 2 1 2 8 14 21 start end 21 21 Search Value: 3 Legend: Array Desired element Desired element Match Current Index Comparing 21 and 14 4 Instruction for the animator Text to be displayed in the working area (DT) Show the text and arrow for mid as shown in figure. Then blink the orange box and blue box to which mid arrow is pointing to. While blinking, a text box saying “ Comparing 21 and 14” must appear. If the values in those 2 boxes doesn’t match, then see whether the number in orange box is greater or less than the number in blue box If greater then display the only blue boxes after mid Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure mid = FLOOR ([0+2]/2) = 1 The desired element to search for in the array is 21 21 is compared with the element at mid 21 ≠ 14 and 21 > 14 Therefore the search for element 21 is done only in the second half . 5

Step 5: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 1 2 8 14 21 start: i=mid +1 = 1+1 = 2 end: j=2 mid: FLOOR ([2+2]/2) = 2 2 i=2 j=2 2 start 21 end 3 21 Search Value: Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Display array with its values inside and numbers above it. Then show the text and arrows in red as shown in figure. Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure Compare i and j -- i<= j - 0<=2 TRUE Finding middle element mid = FLOOR([start +end]/2) 5

Step 6: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 1 2 start: i=2 end: j=2 mid: 2 8 14 21 2 mid=2 i=2 j=2 2 21 Search Value: 3 start 21 end Legend: Array Desired element Desired element Match Current Index 21 Comparing 21 and 21 Element found at location 2 4 Instruction for the animator Text to be displayed in the working area (DT) Show the text and arrow for mid as shown in figure. Then blink the orange box and blue box to which mid arrow is pointing to. While blinking, a text box saying “ Comparing 21 and 21” must appear. If the values in those 2 boxes match, change the color of both the boxes to green. Display the location of desired element. With the text “ Element found at location 2” Always update the value in violet box accordingly. The text in DT should appear in parallel to the figure mid = FLOOR ([2+2]/2) = 2 The desired element to search for in the array is 21 21 is compared with the element at mid 21 = 21 Therefore the search for element 21 is done Element found at location 2 . 5

3 Step 7: 1 2 4 5 Case – 2 (Element not found) i=0 j=7 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 start 8 14 21 25 48 52 60 76 end 2 start: i=0 end: j=7 mid: FLOOR ([0+7]/2) = 3 3 65 Search Value: Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) When the user clicks start, show the figure in master layout without labeling. Display array with its values inside and numbers above it. Then show the text and arrows in red as shown in figure. Show the violet box with values of start, end and calculation of mid value The text in DT should appear in parallel to the figure Array of 8 elements with indices The search value: 65 Initialize start: i=0 and end : j=7 Compare i and j -- i<= j - 0<=7 TRUE Finding middle element mid = FLOOR([start +end]/2) 5

Step 8: 1 i=0 mid=3 j=7 1 2 3 4 5 6 7 start 8 14 21 25 48 52 60 76 end 2 start: i=0 end: j=7 mid: 3 3 65 Search Value: Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Show the text and arrow for mid as shown in figure. Always update the value in violet box accordingly. The text in DT should appear in parallel to the figure mid = FLOOR ([0+7/2) = 3 5

Step 9: 10: 1 i=0 mid=3 j=7 1 2 3 4 5 6 7 start 8 14 21 25 48 52 60 76 end 2 65 start: i=0 end: j=7 mid: 3 Comparing 65 and 25 3 65 Search Value: Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Then blink the orange box and blue box to which mid arrow is pointing to. While blinking, a text box saying “ Comparing 65 and 25” must appear. If the values in those 2 boxes doesn’t match, then see whether the number in orange box is greater or less than the number in blue box If greater then display the only blue boxes after mid Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure The desired element to search for in the array is 65 65 is compared with the element at mid 65 ≠ 25 and 65 > 25 Therefore the search for element 65 is done only in the second half . 5

Step 10: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 i=4 j=7 2 4 5 6 7 start 48 52 60 76 end start: i=mid +1 = 3+1 = 4 end: j= 7 mid: FLOOR ([4+7]/2) = 5 3 65 Search Value: Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Display array with its values inside and numbers above it. Then show the text and arrows in red as shown in figure. Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure Compare i and j -- i<= j - 4<=7 TRUE Finding middle element mid = FLOOR([start +end]/2) 5

Step 11: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 i=4 mid=5 j=7 2 4 5 6 7 start 48 52 60 76 end start: i=4 end: j= 7 mid: 5 3 65 Search Value: Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Show the text and arrow for mid as shown in figure. Always update the value in violet box accordingly. The text in DT should appear in parallel to the figure mid = FLOOR ([4+7/2) = 5 5

Step 12: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 i=4 mid=5 j=7 2 start: i=4 end: j= 7 mid: 5 4 5 6 7 start 48 52 60 76 end 65 3 65 Search Value: Comparing 65 and 52 Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Then blink the orange box and blue box to which mid arrow is pointing to. While blinking, a text box saying “ Comparing 65 and 52” must appear. If the values in those 2 boxes doesn’t match, then see whether the number in orange box is greater or less than the number in blue box If greater then display the only blue boxes after mid Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure The desired element to search for in the array is 65 65 is compared with the element at mid 65 ≠ 52 and 65 > 52 Therefore the search for element 65 is done only in the second half . 5

Step 13: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 4 5 6 7 48 52 60 76 start: i=mid+1 = 5+1 = 6 end: j= 7 mid: FLOOR ([6+7]/2) = 6 2 i=6 j=7 6 7 3 65 Search Value: start 60 76 end Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Display array with its values inside and numbers above it. Then show the text and arrows in red as shown in figure. Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure Compare i and j -- i<= j - 6<=7 TRUE Finding middle element mid = FLOOR([start +end]/2) 5

Step 14: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 4 5 6 7 48 52 60 76 2 start: i=6 end: j= 7 mid: 6 mid=6 j=7 i=6 6 7 3 65 Search Value: 60 76 end start Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Show the text and arrow for mid as shown in figure. Always update the value in violet box accordingly. The text in DT should appear in parallel to the figure mid = FLOOR ([6+7/2) = 6 5

Step 15: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 4 5 6 7 48 52 60 76 2 start: i=6 end: j= 7 mid: 6 mid=6 j=7 i=6 6 7 3 60 76 end 65 start Search Value: 65 Legend: Array Desired element Desired element Match Current Index Comparing 65 and 60 4 Instruction for the animator Text to be displayed in the working area (DT) Then blink the orange box and blue box to which mid arrow is pointing to. While blinking, a text box saying “ Comparing 65 and 60” must appear. If the values in those 2 boxes doesn’t match, then see whether the number in orange box is greater or less than the number in blue box If greater then display the only blue boxes after mid Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure The desired element to search for in the array is 65 65 is compared with the element at mid 65 ≠ 60 and 65 > 60 Therefore the search for element 65 is done only in the second half . 5

Step 16: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 4 5 6 7 48 52 60 76 2 start: i=mid+1 = 6+1 = 7 end: j= 7 mid: FLOOR ([7+7]/2) = 7 6 7 60 76 3 i=7 j=7 65 Search Value: 7 start 76 end Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Display array with its values inside and numbers above it. Then show the text and arrows in red as shown in figure. Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure Compare i and j -- i<= j - 7<=7 TRUE Finding middle element mid = FLOOR([start +end]/2) 5

Step 17: 1 1 2 3 4 5 6 7 8 14 21 25 48 52 60 76 4 5 6 7 48 52 60 76 2 6 7 60 76 start: i=7 end: j= 7 mid: 7 3 mid=7 i=7 j=7 65 7 Search Value: start 76 end Legend: Array Desired element Desired element Match Current Index 4 Instruction for the animator Text to be displayed in the working area (DT) Show the text and arrow for mid as shown in figure. Always update the value in violet box accordingly. The text in DT should appear in parallel to the figure mid = FLOOR ([7+7/2) = 7 5

Step 18: 1 2 3 4 5 6 7 1 8 14 21 25 48 52 60 76 4 5 6 7 48 52 60 76 start: i=0 end: j= 7 mid: 7 2 6 7 60 76 mid=7 65 Search Value: i=7 j=7 3 Legend: Array Desired element Desired element Match Current Index 7 start 76 end 65 Comparing 65 and 76 4 Instruction for the animator Text to be displayed in the working area (DT) Then blink the orange box and blue box to which mid arrow is pointing to. While blinking, a text box saying “ Comparing 65 and 76” must appear. If the values in those 2 boxes doesn’t match, then see whether the number in orange box is greater or less than the number in blue box If greater then display the only blue boxes after mid Here this is the end of the array. Always update the values in violet box accordingly. The text in DT should appear in parallel to the figure The desired element to search for in the array is 65 65 is compared with the element at mid 65 ≠ 76 and 65 > 76 Therefore the search for element 65 is done only in the second half . So i=mid +1 =7+1 = 8 Compare i and j -- i<= j - 8<=7 FALSE This implies array is completed. Element not found in the array. 5

Test your understanding Electrical Engineering Slide 1 Slide 3 Slide 27-30 Slide 31 Introduction Definitions Analogy Test your understanding (questionnaire)‏ Lets Sum up (summary)‏ Want to know more… (Further Reading)‏ Interactivity: Try it yourself Array Size : Values in the array: : Give a dropdown to select the array size from 2- 8 . Place an input box and an ENTER button to enter the values in the array. After ENTER is pressed, show the array with indices on the top in the simulation area. Give another input box to enter the desired element value After the desired element value is entered, show the value in the simulation area. After desired element value is shown, enable START button. Once the animation is started, then enable PAUSE and RESET buttons. Desired element Value : In the input box the user will input all the numerical values that he/she wants to be in the array. 26 Credits

Questionnaire 1 Which of the following are TRUE about Binary search? It is a sequential search Its complexity is O(log n) It is also called half- interval search Answers: a) I and II b) Only II c) II and III d) I, II and III 2 3 4 5

Questionnaire 1 2. For a searching operation to be done using binary search, the array must be Answers: a) Sorted b) Unsorted c) either sorted or unsorted 2 3 4 5

4 Questionnaire 1 2 3 5 3. The following statement is TRUE/ FALSE Binary search is very efficient for large arrays. Answers: a) TRUE b) FALSE 2 3 4 5

Questionnaire 1 4. Binary search takes more comparisons than linear search to find an element Time taken to find an element is more and is the main disadvantage in binary search which of the above are TRUE? Answers: a) I and II b) Only I c) Only II d)None 2 3 4 5

Links for further reading Reference websites: http://en.wikipedia.org/wiki/Binary_search http://video.franklin.edu/Franklin/Math/170/common/mod01/binarySearchAlg.html Books: “Introduction to Algorithm” Thomas H. Coremen