subject

Consider the following quicksort-like sorting algorithm.
Pick two elements of the list. Partition based on both of the elements. So the elements smaller than both are to the left, the elements in between are in the middle, and the elements larger than both are to the right.
(a) Given a brief English description of how you would partition. Write high-level pseudo-code for this algorithm. Try to minimize the number of comparisons. Your algorithm should use a linear number of comparisons.
(b) How many comparisons does the partition algorithm use in the worst case? Justify.
(c) How many comparisons does the partition algorithm use on average? Just get the high order term. Justify informally.
(d) Assume that the two partition elements always partition exactly into thirds. Write a recurrence for the number of comparisons. Solve this recurrence using constructive induction. Just get the high order term exactly.
(e) Assume that the two partition elements always partition so exactly one quarter are to the left, one half in the middle, and one quarter to the right. Write a recurrence for the number of comparisons. Solve this recurrence using constructive induction. Just get the high order term exactly.
(f) Challenge problem, will not be graded. Find the exact high order term for the average number of comparisons.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 15:00
1. what are the biggest risks when using the public internet as a wide area network (wan) or transport for remote access to your organization’s it infrastructure?
Answers: 2
question
Computers and Technology, 21.06.2019 18:20
Write the pseudocode for the following: a function called fahrenheittocelsius that accepts a real fahrenheit temperature, performs the conversion, and returns the real celsius temperature. a function called celsiustofahrenheit that accepts a real celsius temperature, performs the conversion, and returns the real fahrenheit temperature. a main module that asks user to enter a fahrenheit temperature, calls the fahrenheittocelsius function, and displays the celsius temperature with a user-friendly message. it then asks the user to enter a celsius temperature, calls the celsiustofahrenheit function, and displays the fahrenheit temperature with a user-friendly message.
Answers: 1
question
Computers and Technology, 21.06.2019 22:00
Determine which of the four levels of measurement (nominal, ordinal, interval, ratio) is most appropriate for the data below. internet speed levels of "fast comma " "medium comma " and "slow" choose the correct answer below. a. the ordinal level of measurement is most appropriate because the data can be ordered comma but differences left parenthesis obtained by subtraction right parenthesis cannot be found or are meaningless. nothing nothing nothing nothing nothing b. the interval level of measurement is most appropriate because the data can be ordered comma differences left parenthesis obtained by subtraction right parenthesis can be found and are meaningful comma and there is no natural starting point. c. the nominal level of measurement is most appropriate because the data cannot be ordered. nothing d. the ratio level of measurement is most appropriate because the data can be ordered comma differences left parenthesis obtained by subtraction right parenthesis can be found and are meaningful comma and there is a natural starting point.
Answers: 2
question
Computers and Technology, 23.06.2019 20:00
Me ajude por favor , coloquei uma senha e não consigo tira-la no chorme
Answers: 2
You know the right answer?
Consider the following quicksort-like sorting algorithm.
Pick two elements of the list. Parti...
Questions