Exercise 1: Insertion Sort Consider the selection sort implementation from slide # 58 in lecture-12-apr-08.pptx. Change...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Exercise 1: Insertion Sort Consider the selection sort implementation from slide # 58 in lecture-12-apr-08.pptx. Change the code of this method to sort an array of things using same Thing you used in your homework assignments. Remember that things are sorted according to compareTo method. 1.2) Write code in the driver to do the following. 1.1) create an unsorted array of 10 things. print all elements in the array one element per line. call selection sort to sort your array. print all elements in the array after sorting one element per line. What to submit? 1. a screenshot of your selection sort method. 2. a screenshot of your main method. 3. a screenshot of the output window showing the array before and after sorting. DO NOT COPY AND PASTE THE CODE. INCLUDE SCREEN SHOTS. Department of Computer Science and Cybersecurity Exercise 2: Quick Sort Given the following array of numbers. 12 17 20 15 swap: Array after 2nd swap: Array after 3rd swap: Exercise 3: Merge Sort Given the following array integers 17 15 12 7 Suppose we partition this array using quick sort partitioning algorithm using 15 as the pivot. There is a total of three swap operations. Show the array after each swap operation. Array after 1st 20 ICS 240-50 7 18 11 18 25 11 25 Spring 2022 9 31 31 Draw the tree (similar to slide #77 lecture-12-apr-08.pptx) in that shows how the arrays arrays. divided then merged when using Merge Sort? Make sure to show clearly the contents of the sub-arrays in each step. You may draw on a piece of paper and include a screenshot of your paper. Exercise 1: Insertion Sort Consider the selection sort implementation from slide # 58 in lecture-12-apr-08.pptx. Change the code of this method to sort an array of things using same Thing you used in your homework assignments. Remember that things are sorted according to compareTo method. 1.2) Write code in the driver to do the following. 1.1) create an unsorted array of 10 things. print all elements in the array one element per line. call selection sort to sort your array. print all elements in the array after sorting one element per line. What to submit? 1. a screenshot of your selection sort method. 2. a screenshot of your main method. 3. a screenshot of the output window showing the array before and after sorting. DO NOT COPY AND PASTE THE CODE. INCLUDE SCREEN SHOTS. Department of Computer Science and Cybersecurity Exercise 2: Quick Sort Given the following array of numbers. 12 17 20 15 swap: Array after 2nd swap: Array after 3rd swap: Exercise 3: Merge Sort Given the following array integers 17 15 12 7 Suppose we partition this array using quick sort partitioning algorithm using 15 as the pivot. There is a total of three swap operations. Show the array after each swap operation. Array after 1st 20 ICS 240-50 7 18 11 18 25 11 25 Spring 2022 9 31 31 Draw the tree (similar to slide #77 lecture-12-apr-08.pptx) in that shows how the arrays arrays. divided then merged when using Merge Sort? Make sure to show clearly the contents of the sub-arrays in each step. You may draw on a piece of paper and include a screenshot of your paper.
Expert Answer:
Answer rating: 100% (QA)
Selection sort is a sorting algorithm that repeatedly selects the smallest element from an unsorted array and swaps it with the first element of the unsorted arrayThis process is repeated until the en... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In a Hopfield neural network configured as an associative memory, with all of its weights trained and fixed, what three possible behaviours may occur over time in configuration space as the net...
-
Tubby Toys estimates that its new line of rubber ducks will generate sales of $7 million, operating costs of $4 million, and a depreciation expense of $1 million. If the tax rate is 35%, what is the...
-
If equilibrium is compatible with both buyers' and sellers' intentions how can it be undesirable?
-
An accounts receivable manager processes 200 checks per day with an average processing time of 15 working days. Use the Excel template Littles Law to find the average number of accounts receivable...
-
Reconsider the data from Problem 4. Management has expressed some concern over the life of the project and the impact of possible early termination. As a result, you have developed additional data...
-
Huron Company produces a commercial cleaning compound known as Zoom. The direct materials and direct labor standards for one unit of Zoom are given below: During the most recent month, the following...
-
Centralized versus Decentralized Database Management Systems"Please respond to the following: Compare and contrast benefits and challenges that exist between centralized database management systems...
-
In February 2009, Treasury 8.5s of 2020 yielded 3.2976% (see Figure 3.1). What was their price? If the yield rose to 4%, what would happen to the price? FIGURE 3.1 Sample Treasury bond quotes from...
-
In evaluating a double integral over a region D, a In evaluating a double integral over a region D, a sum of iterated integrals was obtained as follows: Df(x,y)dA=204y0f(x,y)dxdy+10210y0f(x,y)dxdy....
-
In terms of influencing organizational effectiveness, since groups are composed of individuals, is group behavior really any different than individual behavior? Why or why not? How do or how would...
-
A house is 52.0 ft long and 34.0 ft wide and has 8.0-ft-high ceilings. What is the volume of the interior of the house in cubic meters and cubic centimeters? m3 cm
-
(a) Write 13.8% as a decimal. (b) Write 0.2 as a percentage. (a) 13.8% = 7 (b) 0.2 =% X S
-
Robin Rinehart summarizes the three compositions relating to the Goddess Candi in the Dasam Granth. Identify and explain one way in which Rinehart links these tales to Sikh teaching.
-
A house is 60.0 ft long and 42.0 ft wide and has 8.0-ft-high ceilings. What is the volume of the interior of the house in cubic meters and cubic centimeters? m cm Submit Answer
-
Calculate the Accuracy and uncertainty of the given instrument. Write the equation and final answer here and show your work on paper 1116 05 10 15 20 25 1/1 221234567 8931234567 8941 2 80 50 60 70 90...
-
If the amplifier indicated by the box input impedance of oo, which of the following statements are true ? has an open loop gain as well as Feedback factor (\beta = 1/ R_1\) The feedback is voltage...
-
Jenny earns $34,500 in 2012. Calculate the FICA tax that must be paid by: Jenny: ..............................Soc,Sec. ..................$______________...
-
Carol Harris, Ph.D, CPA, is a single taxpayer and she lives at 674 Yankee Street, Durham, NC 27409. Her Social Security number is 793-52-4335. Carol is an Associate Professor of Accounting at a local...
-
Kathy Kennedy (age 44) is a single taxpayer and she lives at 212 North Pine Way, Payson, AZ 85541. Her Social Security number is 467-98-9784. Kathy's earnings and income tax withholding as the...
-
The IT implementation project is bogging down and falling behind schedule. The department heads are complaining that the project cannot help them if it is not implemented in a reasonable time frame....
-
This isnt what I need! objected the admissions officer at Northwest Regional Hospital. Judy sighed, But this is the software you asked us to create for you. I dont care what I said at the time, this...
-
Assume the network diagram shown in Figure 11.19. Megan is responsible for activities A and C. Use the critical chain methodology to resource-level the network. What are two options for redrawing the...
Study smarter with the SolutionInn App