Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
List all the steps used to search for 18 in the sequence 1, 2, 4, 8, 10, 12, 18, 20, 22. Be sure to show EVERY step.
A. linear search
B. binary search
Use the following array and indices in your answer:
Array: | 1 | 2 | 4 | 8 | 10 | 12 | 18 | 20 | 22 |
---|---|---|---|---|---|---|---|---|---|
Index: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 2. For the following array, you are to perform a binary search: Int nums[ ]= {1, 13, 78, 89, 96, 100, 112, 125, 230, 310, 423, 578, 1000); Search for the number 126 by showing the low, midpoint and high values at each step before it reports that 126 is NOT found in the array. Low Mid Higharrow_forwardUse binary search on the sorted array shown below:{10,12,17,17,23,25,31}Describe what happens when searching for the following numbers, using array diagrams.2a. Searching for the number 25.2b. Searching for the number 15.arrow_forwardThe first element in each array is accessed with index number 0. (e.g., array[0]). Select one: True Falsearrow_forward
- Assume the array is sorted according to the roll number. Jonny, as a school teacher conducted the test in the class and students submitted responses along with time duration to complete the test. Now your task is to find the student number who taken the most time. In kotlinarrow_forwardBinary Search: Use the binary search method to find (or fail to find) the following numbers in the array provided. Sketch out the stages of each search: [1,5,8,14,25,26,33,42,52,53,54,56,64,74,93,104] 1. Look for 42. 2. Look for 67.arrow_forwardThe contents of the array below represent a maxHeap. What would be the contents of the array after a deletion. Briefly explain how the deletion is done. 60 20 30 5 10 15 25arrow_forward
- Given the following array, what is the content of the array after Three passes of Insertion Sort? array: 44 12 50 3 40 23 Question 5 options: 3 12 44 50 40 23 12 44 50 3 40 23 12 3 23 40 44 50 12 3 44 50 40 23arrow_forwardThe index type of an array may be any kind of data. Do you believe this to be true?arrow_forwardUse the following array to trace the values of first, last, and middle (show subscripts) to search for 6 using the binary search. 6. 8. 19 27 31 38 42 first last middlearrow_forward
- An array index starts with -1 1 0 O 2arrow_forwardPleasearrow_forwardse for loops on the above 2D array to: •Find how many ZEROsand how many negative numbersare in the matrixand display results*HELP: declare a variable “count_zero= 0and count_neg=0” and increment the count each time you findzero and negativearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage