(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. How many times is x compared with an element in the list? How many 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. How many times is x compared with an element in the list? How many 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. How many times is x compared with an element in the list? How many 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)
- Elements Of Modern AlgebraAlgebraISBN:9781285463230Author:Gilbert, Linda, JimmiePublisher:Cengage Learning,Linear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage Learning