Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
5th Edition
ISBN: 9780134801155
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
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.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents 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
Chapter 9 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Ch. 9.3 - Which of the sorting algorithms discussed makes...Ch. 9.3 - Prob. 9.2CPCh. 9.3 - Prob. 9.3CPCh. 9.4 - Prob. 9.4CPCh. 9.4 - On average, with an array of 1,000 elements, how...Ch. 9.4 - Prob. 9.6CPCh. 9 - Prob. 1MCCh. 9 - Prob. 2MCCh. 9 - Prob. 3MCCh. 9 - Prob. 4MC
Ch. 9 - Prob. 5MCCh. 9 - Prob. 6MCCh. 9 - Prob. 7MCCh. 9 - Prob. 8MCCh. 9 - Prob. 9MCCh. 9 - Prob. 10MCCh. 9 - Prob. 1TFCh. 9 - Prob. 2TFCh. 9 - Prob. 3TFCh. 9 - Prob. 4TFCh. 9 - Prob. 5TFCh. 9 - Prob. 1AWCh. 9 - Prob. 2AWCh. 9 - Prob. 3AWCh. 9 - What algorithm does the following pseudocode...Ch. 9 - Prob. 1SACh. 9 - Prob. 2SACh. 9 - Prob. 3SACh. 9 - Prob. 4SACh. 9 - Prob. 5SACh. 9 - Why is the selection sort more efficient than the...Ch. 9 - Prob. 7SACh. 9 - Prob. 8SACh. 9 - Assume the following main module is in a program...Ch. 9 - Prob. 1PECh. 9 - Sorted Names Design a program that allows the user...Ch. 9 - Rainfall Program Modification Recall that...Ch. 9 - Name Search Modify the Sorted Names program that...Ch. 9 - Charge Account Validation Recall that Programming...Ch. 9 - Prob. 7PECh. 9 - Sorting Benchmarks Modify the modules presented in...
Knowledge Booster
Similar questions
- Complete the following table by calculating the average and maximum number of comparisons the linear search will perform, and the maximum number of comparisons the binary search will perform.arrow_forwardWhat is the maximum number of elements that will be inspected if a sequential search of 4000 names is performed?arrow_forwardLet N be an unordered array of integers. The maximum number of compares required to find the minimum value is N. Select one True or Falsearrow_forward
- The maximum number of compares to binary search for a key in a sorted array is log2 n Select one: True or Falsearrow_forwardWhat is the procedure for doing a selective sort on an array of elements?arrow_forwardBinary search will perform at most ( ) comparisons on a sorted array of 256 elements. Group of answer choices 512 256 9 8arrow_forward
- Let N be an unordered array of integers. The maximum number of compares required to find the minimum value is N-1. [True/False]arrow_forwardbsfdb sdfd ddfvxcvarrow_forwardالسؤال sequential search: what is the running time of the best case to search if all the elements of an array are equal ? الاجابات O(1) O(n) O(n^2) n log narrow_forward
- The element being searched for is not in an array of 100 elements. What is the maximum number of comparisons needed in a sequential search to determine that the element is not there if the elements are completely unsorted?arrow_forwardFor a sorted list of 1024 elements, a binary search takes at most comparisons. 11 100 512 6.arrow_forwardIn an array-based implementation of a dictionary, using one array to store the search keys and a separate array to store the corresponding values is called O O parallel arrays concurrent arrays corresponding arrays duplicate arraysarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education