Question

Suppose we use RANDOMIZED-SELECT to select the minimum element of the array A = {12, 0,...

Suppose we use RANDOMIZED-SELECT to select the minimum element of the array A = {12, 0, 4, 3, 5, 7, 9, 2, 8, 11}. Describe a sequence of partitions that results in a worst-case performance of RANDOMIZEDSELECT.

Homework Answers

Answer #1

Q.Suppose we use RANDOMIZED-SELECT to select the minimum element of the array A = {12, 0, 4, 3, 5, 7, 9, 2, 8, 11}. Describe a sequence of partitions that results in a worst-case performance of RANDOMIZEDSELECT.

Answer:

In the example, the sequence would be{ 12,11,9,8,7,5,4,3,2,0 }

  • pivot 12 { 0,4,3,5,7,9,2,8,11}
  • pivot 11 {0,4,3,5,7,9,2,8}
  • pivot 9 {0,4,3,5,7,2,8}
  • pivot 8 {0, 4, 3, 5,7,2 }
  • pivot 7 {0, 4, 3, 5, 2}
  • pivot 5 {0, 4, 3, 2}
  • pivot 4 {0, 3, 2}
  • pivot 3 {0, 2}
  • pivot 2 {0}
  • return 0
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
We are given an array A of size n containing n positive and negative integers (the...
We are given an array A of size n containing n positive and negative integers (the array is indexed starting from 0). Our goal is to find two indices i and j such that 0 ≤ i ≤ j ≤ n and Pk=j k=i A[k] is maximized. Input sequence: [2, -4, 1, 9, -6, 7, -3] Output: [1, 9, -6, 7] or i = 2 and j = 5 Input sequence: [1, 2, 3, 4, 5, 6, -3] Output: [1,...
Use the following to answer the questions below: Below are the marginal costs of abating pollution...
Use the following to answer the questions below: Below are the marginal costs of abating pollution for three firms in an industry, based on their emissions levels. Each firm is now emitting 10 tons/week, so total emissions are 30 tons/week. Suppose we wish to reduce total emissions by 50 percent, to 15 tons per week in this industry. Marginal Abatement Costs ($/ton) Emissions (tons/week) Firm 1 Firm 2 Firm 3 10 0 0 0 9 5 1 1 8 9...
Suppose we consider a bus "old" if it has been in service more than 8 years....
Suppose we consider a bus "old" if it has been in service more than 8 years. At the 0.01 significance level, can we conclude that less than 40% of the district's buses are old? Report the p-value. Age 5 2 10 2 2 5 10 8 7 9 10 10 4 6 6 6 3 3 8 8 3 9 7 3 9 8 4 6 9 6 9 9 1 6 8 9 9 11 9 7 6 9...
For questions 1 and 2 declare the array size as name constant first then use it...
For questions 1 and 2 declare the array size as name constant first then use it to declare the array 1. Declare an array named scores of type double and size 30. 2. Declare an array named names of string objects and size 15 3. Given the following array definition: int values[] = {2, 5, 8, 11}; What does each of the following display? cout << values[1];         B) cout << value[3]+values[0];   Define a three element array named letters, initialize it...
The code segment in Listing 1, when completed and executed, creates nums, an uninitialized 4-integer array....
The code segment in Listing 1, when completed and executed, creates nums, an uninitialized 4-integer array. It stores 4 and 5 as the first and second elements, respectively, of the array. It adds the first and second elements of the array and stores their sum as the third element of the nums. It prints the third element of nums. It then adds the second and third elements of the array and stores their sum as the fourth element of nums....
Given the following unordered array: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]...
Given the following unordered array: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] W X D T P N R Q K M E If the array was being sorted using the SHELL sort and the halving method, and sorting into ASCENDING order as demonstrated in the course content, list the letters in the resulting array, in order AFTER the FIRST pass. [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
Consider the experimental results for the following randomized block design. Make the calculations necessary to set...
Consider the experimental results for the following randomized block design. Make the calculations necessary to set up the analysis of variance table. Treatment A B C 1 11 10 9 Blocks 2 12 6 6 3 18 16 14 4 21 18 19 5 8 8 9 Use = .05 to test for any significant differences. Show entries to 2 decimals, if necessary. Round p-value to four decimal places. If your answer is zero enter "0". Source of Variation Sum...
(Data Structure) Suppose we want to store the data of a binary heap in an array....
(Data Structure) Suppose we want to store the data of a binary heap in an array. Show the data of that array after inserting the given keys one by one. Assume that initially binary heap is empty. Show all steps of insertions. Note: No need to show the changes for each step of “percolate up”. The contents of the array must be shown after completing one insertion. Create the “Min Heap” for the following data set 7,      3,      18,    -9,    ...
A manager at a local discount gym believes that less than 20% of gym members use...
A manager at a local discount gym believes that less than 20% of gym members use the gym, at least 5 days a week. She randomly selects 100 gym members and tracks (using the electronic login system at the door) how many days they used the gym over the 2-week period. The following are the results: 2 3 10 4 2 3 8 4 8 10 5 0 6 3 9 13 6 3 12 5 3 3 5 1...
Dep Delay Arr Delay q1 -13 -9 q3 1 3 IQR 14 12 stdev 9.211846 9.660933...
Dep Delay Arr Delay q1 -13 -9 q3 1 3 IQR 14 12 stdev 9.211846 9.660933 negative 291 zero 39 positive 170 total (should be 500) 500 all data is for arrival data. please help me explain these can someone help me answer these questions and tell me how to put them in excel.thanx in advance 1.    Define a random variable (X) so that your chosen data set represents values of X. 2.    Is your chosen random variable discrete or...