C# PLEASE Lab9B: Binary Bubbles. Binary search is a very fastsearching algorithm, however it requires a set
Fantastic news! We've Found the answer you've been seeking!
Question:
C# PLEASE Lab9B: Binary Bubbles. Binary search is a very fastsearching algorithm, however it requires a set of numbers to besorted first.
Transcribed Image Text:
Lab9B: Binary Bubbles. Binary search is a very fast searching algorithm, however it requires a set of numbers to be sorted first. For this lab, create an array full of 11 integers which the user will generate. Like in the previous lab, assume that the values will be between -100 and +100. Then, using the sorting algorithm called BubbleSort, put the array in the correct order (from lowest to highest number). After this, please print the array to the screen. Finally, search the array for the target value using Binary Search. The BinarySearch code will implement the algorithm described in the lab slides. During this, you should print out a few key values which help Binary Search function. For example, this algorithm focuses on a low, mid, and high which correspond to the indices in the array the algorithm is currently considering and searching. Printing these values during the search process will help with debugging and fixing any issues. • BubbleSort sorts the array to prepare for the next step • BinarySearch searches the now sorted array to determine if the target value is in the array or not Remember, the file name should be Lab9B. The user input is indicated in bold. Sample output #1 Please enter 11 numbers: Integer 1: 15 Integer 2: 12 Integer 3: 89 Integer 4: -14 Integer 5: 11 Integer 6: -99 Integer 7: 1 Integer 8: 42 Integer 9: 27 Integer 10: 2 Integer 11: 67 What is the target number: 42 The sorted set is: -99 -14 1 2 11 12 15 27 42 67 89 Low is 0 High is 10 Mid is 5 Searching Low is 6 High is 10 Mid is 8 Searching The target is in the set. Lab9B: Binary Bubbles. Binary search is a very fast searching algorithm, however it requires a set of numbers to be sorted first. For this lab, create an array full of 11 integers which the user will generate. Like in the previous lab, assume that the values will be between -100 and +100. Then, using the sorting algorithm called BubbleSort, put the array in the correct order (from lowest to highest number). After this, please print the array to the screen. Finally, search the array for the target value using Binary Search. The BinarySearch code will implement the algorithm described in the lab slides. During this, you should print out a few key values which help Binary Search function. For example, this algorithm focuses on a low, mid, and high which correspond to the indices in the array the algorithm is currently considering and searching. Printing these values during the search process will help with debugging and fixing any issues. • BubbleSort sorts the array to prepare for the next step • BinarySearch searches the now sorted array to determine if the target value is in the array or not Remember, the file name should be Lab9B. The user input is indicated in bold. Sample output #1 Please enter 11 numbers: Integer 1: 15 Integer 2: 12 Integer 3: 89 Integer 4: -14 Integer 5: 11 Integer 6: -99 Integer 7: 1 Integer 8: 42 Integer 9: 27 Integer 10: 2 Integer 11: 67 What is the target number: 42 The sorted set is: -99 -14 1 2 11 12 15 27 42 67 89 Low is 0 High is 10 Mid is 5 Searching Low is 6 High is 10 Mid is 8 Searching The target is in the set.
Expert Answer:
Answer rating: 100% (QA)
C program that searches for an integer in an array using binary search using System class Lab9B static void Main create an array of size 11 int number... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these electrical engineering questions
-
Binary Search is performed on a sorted set of elements, it compares the number to be found with the middle element, if it is not the same, then it checks which (left or right) subarray will contain...
-
Binary search of a sorted array takes logarithmic search time, but the time to insert a new element is linear in the size of the array. We can improve the time for insertion by keeping several sorted...
-
A fragment of the source code for a Binary Search Tree (BST) in JavaScript is given down below: class Node { constructor(val){ this.val = val this.left = null this.right = null } } class BST {...
-
Dakota Company purchased several assets from a competitor, paying a lump-sum of $1,000,000 (one million dollars). The assets included: i. Land - valued at $420,000 ii. Building - valued at $400,000...
-
Hogvertz Elvin Catering (HEC) is considering switching from its old food maker to a new Wonder Food Maker. Both food makers will remain useful for the next 10 years, but the new food maker will...
-
A Time Magazine article titled Wal-Marts Gender Gap (July 5, 2004) stated that in 2001 women managers at Wal-Mart earned $14,500 less than their male counterparts. a. If these data are based on a...
-
Lance Co. purchased 100 shares of Mallard common stock at \$20 per share on March 15, 2020. Mallard declared and paid a dividend of \(\$ 1.50\) per share in 2020. The market price on December 31,...
-
Cavalier Company has several processing departments. Costs charged to theAssembly Department for November 2010 totaled $2,229,000 as follows.. Production records show that 35,000 units were in...
-
Differential Analysis Report for Lease orSellInman Construction Company is considering selling excess machinerywith a book value of $280,000 (original cost of $400,000 lessaccumulated depreciatio 2...
-
Select all that apply Actual output is used for variance calculations because Blank______. Multiple select question. budgeted output although useful for planning is outdated for analyzing performance...
-
Suppose that 6 routers (u, v, w, x, y and z) are connected as follows with the cost of each link shown next to it. 3 1 m a) Use Dijkstra's algorithm to compute the least cost paths from Router u to...
-
George was working at a grocery store, ABC Grocery, on a beautiful Monday morning. As he was stocking some shelves, he saw his former high school enemy, Claire. She was shopping at the store. George...
-
A 5,900-kg truck runs into the rear of a 1,000-kg car that was stationary. The truck and car are locked together after the collision and move with speed 3 m/s. Compute how much kinetic energy was...
-
First read the information from the following website: https://www.canada.ca/en/employment-social-development/services/health-safety/cannabis-workplace/questions-answers.html; Note that the emphasis...
-
An Italian company is expecting to receive Kuwait dinars in 9 months' time. The spot rate is Lire/dinar 5.467.Your Company could borrow in dinar at 9% per annum or in Lire at 14% per Annum No forward...
-
The table below (on the next page) lists data on the indexes of aggregate final energy demand (Y), real GDP (X), and real energy price (X) for several developed countries. Estimate a log-liner model...
-
Question 11 of 14 View Policies -/1 Current Attempt in Progress In its income statement for the year ended December 31, 2022, Kingbird, Inc. reported the following condensed data. Operating expenses...
-
When is the indirect pattern appropriate, and what are the benefits of using it?
-
Find all solutions to the equations x 4 (mod 5) and x 5 (mod 11).
-
Consider the following multithreaded pseudocode for transposing an n à n matrix A in place: Analyze the work, span, and parallelism of this algorithm. P-TRANSPOSE(A) 1 n = A.rows 2 parallel...
-
Prove that the maximum element in a symmetric positive-definite matrix lies on the diagonal.
-
1.11 Market Conditions. The decisions of MNEs to move to new markets invariably take advantage of both market imperfections and market efficiencies. Explain.
-
1.12 Why Go. Why do firms become multinational?
-
1.13 Investment Motives of Firms. What is the differ- ence between proactive and defensive investment motives?
Study smarter with the SolutionInn App