Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java question 6. (14 Points] Search& Sorting: a. [4 Points) suppose we are performing a binary search on a sorted array called numbers initialized as

Java question
image text in transcribed
6. (14 Points] Search& Sorting: a. [4 Points) suppose we are performing a binary search on a sorted array called numbers initialized as follows: // index 0 1 2 3 45 6 7 89 10 11 12 13 14 int ] numbers- hdmbr1, 3, 5, 8, 15, 18, 22, 39, 40, 42, 50, 57, 71,73,74): /l search for the value 42 int index-binarySearch(numbers, 42) Write the indexes of the elements that would be examined by the binary (the mid values in our algorithm's code) and write the value returned from the search. Assume that we are using the binary search a shown in lecture section. search that would be gorithm i. What are the indexes examined? ii. What is value returned? [10 Points] Given the following array of int elements: int numbers 17, 2, 8, 4, 1, 11, 9, b. 5, 3, 10); You don't need to write the code. Just show the working. i. Show the state of the elements after 5 passes of the outermost loop of selection sort. Show a trace of 2 levels deep of the merge sort algorithm. Show the splitting of the overall array, plus one level deep of the recursive calls

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 27th International Conference Dasfaa 2022 Virtual Event April 11 14 2022 Proceedings Part 2 Lncs 13246

Authors: Arnab Bhattacharya ,Janice Lee Mong Li ,Divyakant Agrawal ,P. Krishna Reddy ,Mukesh Mohania ,Anirban Mondal ,Vikram Goyal ,Rage Uday Kiran

1st Edition

3031001257, 978-3031001253

More Books

Students also viewed these Databases questions