Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
5th Edition
ISBN: 9780134801155
Author: Tony Gaddis
Publisher: PEARSON
Question
Book Icon
Chapter 9.4, Problem 9.6CP
Program Plan Intro

Binary search:

  • Binary search is a smart search process that searches for the particular element that is present in the array from the middle towards the left or right until the search element is found.
  • The search element is searched from the middle as the elements present in the array needs to present in the sorted order.
    • If the search element is larger it will search towards the right of the array.
    • If the search element is smaller it will search towards the left of the array.
  • The search continues in a narrow way that it searches for the quarter of the array until there are no values left in the array to search or compare.
  • The search of the target element is made in the smart way it eliminates a portion of array based on the given element as the array is sorted.

Blurred answer
Students have asked these similar questions
If an has n elements, then the first value in the array can always be accessed with a[1]. What is true, and what is false?
Data Structure & Algorithm: Here is an array with exactly 15 elements:1   2   3   4   5   6   7   8   9   10   11   12   13   14   15Suppose that we are doing a serial search for an element. Circle any elements that will be found by examining two or fewer numbers from the array.
If N represents the number of elements in a list, then searching for an element in a sorted array-based list takes no less than O(N) time. True False
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education