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, Problem 4SA
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
what is the maximum number of comparisons that a Binary Search function will make when searching for a value in a 100-element array?
If a sequential search method is searching for a value that is stored in the last element of a 10,000-element array, how many elements will the search code have to read to locate the value?
Sorting is a basic issue with arrays in which the goal is to find the target element in the array. Choose from the following options: False
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage