Question

In: Statistics and Probability

. 36 1 2 31 44 1 1 9 Complete the following: a) Use the bubble...

. 36 1 2 31 44 1 1 9

Complete the following:

a) Use the bubble sort (page 214) to sort the values showing the order of the values in the list after every pass of the sorting algorithm.

b) What is the time complexity of the sort (use the number of comparisons required as a measure of time.)   

c) Modify the algorithm so it stops if there are no swaps in a complete pass. How many comparisons would be needed in your specific example?

d) Choose one of the following properties of Algorithms and show that the bubble sort has the given property:

  • Input: an algorithm has input values;

  • Output: from each set of input values an algorithm produces output values that are a solution to the problem;

  • Definiteness: the steps in an algorithm must be precisely defined;

  • Correctness: an algorithm must produce the correct output values for each set of input values;

  • Finiteness: an algorithm should produce the output after a finite number of steps;

  • Effectiveness: it must be possible to perform each step in the algorithm in a finite amount of time;

  • Generality: the algorithm must be applicable to a category of problems, not a single set of input values.


Solutions

Expert Solution


Related Solutions

13 25 40 20 28 48 19 14 Complete the following: a) Use the bubble sort...
13 25 40 20 28 48 19 14 Complete the following: a) Use the bubble sort (page 214) to sort the values showing the order of the values in the list after every pass of the sorting algorithm. b) What is the time complexity of the sort (use the number of comparisons required as a measure of time.) c) Modify the algorithm so it stops if there are no swaps in a complete pass. How many comparisons would be needed...
Complete the square? 25x^2 - 150x - 75 = -16y^2 - 64y + 36
Complete the square? 25x^2 - 150x - 75 = -16y^2 - 64y + 36
Use the following information to answer questions 31 to 36: CDE Ltd has provided you with...
Use the following information to answer questions 31 to 36: CDE Ltd has provided you with the following data relating to the product manufactured by his factory: Selling price per unit $ 100 Variable manufacturing costs per unit 48 Fixed manufacturing costs per annum 250,000 Variable marketing, distribution and administration costs per unit 16 Fixed non-manufacturing costs per annum 182,000 What is the contribution margin per unit? Show your workings. Calculate quantity to produce to break even in both units...
Question 2 REQUIRED: (1) Complete the following partial worksheet. (9 marks) (2) Using your worksheet information,...
Question 2 REQUIRED: (1) Complete the following partial worksheet. (2) Using your worksheet information, prepare closing entries (for December 31 of the current year) in the journal paper on the next page. Note: Explanations are NOT required. (3) Assuming the journal entries prepared in part (2) have been posted, prepare a Post-Closing Trial Balance (on the next page). Hint: you may find it helpful to use a T-account for calculating Capital. account titles adjusted trial balance    income statement statement...
Question 2 Raw data: 19 14 25 17 29 24 36 23 9 26 22 31...
Question 2 Raw data: 19 14 25 17 29 24 36 23 9 26 22 31 19 28 8 2.1 Group the data into a frequency distribution with a lowest class lower limit of 8 and class width of 7, then draw an ogive curve and use it to estimate the mean
Use the following stem & leaf plot to complete each part. Key: 1|2 = 12 1|2...
Use the following stem & leaf plot to complete each part. Key: 1|2 = 12 1|2 5 2|3 5 5 3|3 5 4|0 2 4 8 5|0 3 5 5 9 6|1 3 a) Write the data values represented by the stem and leaf plot. b) Find the five number summary for the data. c) Draw a boxplot to represent the five number summary from part a.
Write a complete program to sum the following series: (hint: use the for loop) 1 /2...
Write a complete program to sum the following series: (hint: use the for loop) 1 /2 + 1/ 4 + 1 /6 + ⋯ + 1 /100 PS: use C++ language please
Change roles and complete Role play Exercise 2 Pages 35- 36
Change roles and complete Role play Exercise 2 Pages 35- 36
Use the information in problems 2 and 3 to complete the following 2-trait cross.             A...
Use the information in problems 2 and 3 to complete the following 2-trait cross.             A male, raised-nose sasquatch is heterozygous for nail color. A flat-nosed, black-nailed female sasquatch who is heterozygous for nose bridge form and is homozygous for nail color. a. What are the genotypes of the male and female sasquatches? b. Report all possible genotypes of potential offspring. Give the phenotype for each genotype. c. Calculate the expected genotype ratio and the expected phenotype ratio for the...
Option #2: Financial Statement Analysis Problems Complete the following problems: 1. For this problem, use the...
Option #2: Financial Statement Analysis Problems Complete the following problems: 1. For this problem, use the following randomly generated list of accounts, placing them in appropriate order to prepare an income statement. Accounts ($000,000) Depreciation 25 General and administrative expenses 22 Sales 345 Sales expenses 18 Cost of goods sold 255 Lease expense 4 Interest expense 3 The following randomly constructed table requires that as part of your Critical Thinking Assignment you arrange the accounts into a well-labeled income statement....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT