(a)
The sequence of steps in a binary search to x= 7 in the list 3,5,7,20,12,15,17,22,24,30,31. Also find the number of times x is compared with an element in the list and the number of times would it be compared with an element in the list if we employed a linear search.
(b)
The sequence of steps in a binary search to x= 30 in the list 3, 5, 7, 20, 12, 15, 17, 22, 24, 30, 31. Also find the number of times x is compared with an element in the list and the number of times would it be compared with an element in the list if we employed a linear search.
(c)
The sequence of steps in a binary search to x = 16 in the list 3, 5, 7, 20, 12, 15, 17, 22, 24, 30, 31. Also find the number of times x is compared with an element in the list and the number of times would it be compared with an element in the list if we employed a linear search.
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Discrete Mathematics with Graph Theory (Classic Version) (3rd Edition) (Pearson Modern Classics for Advanced Mathematics Series)
- Algebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:CengageFunctions and Change: A Modeling Approach to Coll...AlgebraISBN:9781337111348Author:Bruce Crauder, Benny Evans, Alan NoellPublisher:Cengage LearningCollege AlgebraAlgebraISBN:9781305115545Author:James Stewart, Lothar Redlin, Saleem WatsonPublisher:Cengage Learning