(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)
- (4) For the zero-one matrices A = and B = calculate (а) АЛ В (Ъ) АоВ (c) BOB (5) Show all the steps used by the procedure max in the notes to find the biggest number in the list: 3, 4,8, 2arrow_forwardPlease use Dr.Racket: How can we express Mid-Square hashing for racket program?arrow_forwardUse the binary exponentiation algorithm to compute the remainder when 385 is divided by 53.arrow_forward
- Lupe and Erik continue to argue about Chevrolet and Ford, and try to determine which is better. Lupe finds a Chevrolet will lose 18.3% of its value every year for its first 15 years. Erik determines that Ford is able to keep 81.8% of its value every year for its first 15 years. Assume that each value is at $25,000.00. a) Write a recursive rule for each Chevrolet and Ford. b) Write a closed-form function rule that models the value of the Brand on a yearly basisarrow_forwardHow do you solve the addition problem using lattice algorithm?arrow_forwardFill up the table and by nearest neighbor algorithm’sarrow_forward
- Fill in the blanks (the dashed boxes) below to show how to do the partial products algorithm for 41 x 95. 41 x 95arrow_forwardDiscrete Math Q. Consider your ID: AB-CDEFG-H(21-45194-2). Now construct a BST(Binary Search tree) using the numbers below A, B, C, D, E, F, G, Harrow_forwardWhat is the use of the Euclidean algorithm?arrow_forward
- Expand (2+√9)3arrow_forwardInformation about ocean weather can be extracted from radar returns with the aid of a special algorithm. A study is conducted to estimate the difference in wind speed as measured on the ground and via the Seasat satellite. To do so, wind speeds (miles per hour) are measured on the ground and via the Seasat satellite simultaneously at 12 special times. The data is shown in the following table. The table also shows the difference between the wind speed on the ground and that via the Seasat satellite at each time, as well as some summary statistics. Difference Time Ground (x) Satellite (y) d = x – y 1 4.46 4.08 0.38 3.99 3.94 0.05 3.73 5.00 -1.27 4 3.29 5.20 -1.91 4.82 3.92 0.90 6. 6.71 6.21 0.50 7 4.61 5.95 -1.34 8 3.87 3.07 0.80 9. 3.17 4.76 -1.59 10 4.42 3.25 1.17 11 3.76 4.89 -1.13 12 3.30 4.80 -1.50 d = -0.41 Sd = 1.14arrow_forwardYou are looking for an item in an ordered list 450,000 items long (the length of Webster’s Third New International Dictionary). How many steps might it take to find the item with a sequential search? A binary search?arrow_forward
- College Algebra (MindTap Course List)AlgebraISBN:9781305652231Author:R. David Gustafson, Jeff HughesPublisher:Cengage Learning