Given a list of n numbers, the Selection Problem is to find the kth smallest element...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Given a list of n numbers, the Selection Problem is to find the kth smallest element in the list. The first algorithm (Algorithm 1) is the most straightforward one, i.e. to sort the list and then return the kth smallest element. It takes O(n log n) amount time. The second algorithm (Algorithm 2) is to apply the procedure Partition used in Quicksort. The procedure partitions an array so that all elements smaller than some pivot item come before it in the array and all elements larger than that pivot item come after it. The slot at which the pivot item is located is called the pivotposition. We can solve the Selection Problem by partitioning until the pivot item is at the kth slot. We do it by recursively partitioning the left subarray if k is less than pivotposition, and by recursively partitioning the right subarray if k is greater than pivotposition. When k = pivotposition, we're done. The best case complexity of this algorithm is O(n) while the worst case is O(n2). The third algorithm (Algorithm 3) is to apply the Partition algorithm with the mm rule and it's theoretical worst case complexity is O(n). Program the following three algorithms that we covered in the class: Algorithm 1: find the kth smallest element in the list using the O (n log n) Mergesort sorting method. Algorithm 2: find the kth smallest element in the list using partition procedure of Quicksort recursively. Algorithm 3: find the kth smallest element in the list using partition procedure of Quicksort recursively via Medians of Medians (mm). You can use either Java, or C++ for the implementation. The objective of this project is to help student understand how above three algorithms operates and their difference in run-time complexity (average- case scenario). The project will be divided into three phases to help you to accomplish above tasks. They are Part 1: Design and Theoretical analysis, Part 2: Implementation, and Part 3: Comparative Analysis. Given a list of n numbers, the Selection Problem is to find the kth smallest element in the list. The first algorithm (Algorithm 1) is the most straightforward one, i.e. to sort the list and then return the kth smallest element. It takes O(n log n) amount time. The second algorithm (Algorithm 2) is to apply the procedure Partition used in Quicksort. The procedure partitions an array so that all elements smaller than some pivot item come before it in the array and all elements larger than that pivot item come after it. The slot at which the pivot item is located is called the pivotposition. We can solve the Selection Problem by partitioning until the pivot item is at the kth slot. We do it by recursively partitioning the left subarray if k is less than pivotposition, and by recursively partitioning the right subarray if k is greater than pivotposition. When k = pivotposition, we're done. The best case complexity of this algorithm is O(n) while the worst case is O(n2). The third algorithm (Algorithm 3) is to apply the Partition algorithm with the mm rule and it's theoretical worst case complexity is O(n). Program the following three algorithms that we covered in the class: Algorithm 1: find the kth smallest element in the list using the O (n log n) Mergesort sorting method. Algorithm 2: find the kth smallest element in the list using partition procedure of Quicksort recursively. Algorithm 3: find the kth smallest element in the list using partition procedure of Quicksort recursively via Medians of Medians (mm). You can use either Java, or C++ for the implementation. The objective of this project is to help student understand how above three algorithms operates and their difference in run-time complexity (average- case scenario). The project will be divided into three phases to help you to accomplish above tasks. They are Part 1: Design and Theoretical analysis, Part 2: Implementation, and Part 3: Comparative Analysis.
Expert Answer:
Related Book For
Problems Solving In Data Structures And Algorithms Using C++
ISBN: 9789356273177
2nd Edition
Authors: Hemant Jain
Posted Date:
Students also viewed these databases questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
1. You are required to compare the results of your printed reports and the results of reports of the MYOB assignment book in your MYOB assignment. If it is assumed that two results of the reports are...
-
Assume that a company purchases merchandise for resale on December 20, 2012. The merchandise is still on hand on December 31, the company's year-end. On January 12, 2013, the merchandise is sold to a...
-
A band playing on a flat-bed truck is approaching you rapidly near the end of a parade. Will you hear the same pitch for the various instruments as someone down the street who has already been passed...
-
In September 1990, the chairman of the Securities Exchange Commission criticized carrying investments at amortized cost and argued that, in the banking and savings & loan industries, "serious...
-
Depletion ComputationsMining Henrik Mining Company purchased land on February 1, 2010, at a cost of $1,250,000. It estimated that a total of 60,000 tons of mineral was available for mining. After it...
-
Identify a successful organization. ( you are free to choose a not-for-profit or public-sector agency if you wish.) Reflect on how this organization has succeeded thanks to effective use of...
-
Simtek projects year-end EBIT of $800M which is expected to grow at 5% annually, and capital expenditures will equal depreciation. Simtek has $4,590M of 6% perpetual debt trading at face value and no...
-
Entropy involves how the energy is distributed throughout the system. True or false, justify your answer. Word limit 300-350 Please don't copy paste.-
-
1.3 Table 1 below, presents the total salaries (in million pounds) and the number of points earned for 20 English Premier League teams in 1995/6. Table 1 English Premier League Teams data Team's name...
-
Pool your time length data with data from other class members or the entire class so that the pooled data set has at least 100 observations. Designate someone in the group to calculate the mean and...
-
You are a senior financial analyst of a firm based in Melbourne. You have been assigned with the task of training interns who recently joined your firm on how to use the free cash flow model to...
-
a.[2pts] Create a 1-variable Data table where the input is the sales growth rate, and the output is the NPV. The sales growth rate should increase from 7.5% to 12% with a constant increment of 0.5%....
-
The Mickey Corporation needs to perform the following activities with time given in weeks. (Please see the table below): Activity A B D E F G H I Immediate Predecessors A C B. D A, E E F G, H...
-
a) A survey of top executives revealed that 35% of them regularly read time magazine 20% read Newsweek and 40% percent read US News and World reports. 10% read both Time and US News & World...
-
A manufacturer can sell product 1 at a profit of $20 per unit and product 2 at a profit of $40 per unit. Three units of raw material are needed to manufacture one unit of product 1, and six units of...
-
Implement stack using a queue. Write a program for this problem. You can use just one queue. A queue is a First-In-First-Out (FIFO) kind of data structure. The element that is added to the queue...
-
True or false a. 5n + 10 n 2 = O(n 2 ) b. n log n + 4 n = O(n) c. log(n 2 ) + 4 log(log n) = O(logn) d. 12 n 1/2 + 3 = O(n 2 ) e. 3 n + 11 n 2 + n 20 = O(2 n )
-
The worst-case runtime Complexity of insertion into a BST with n nodes is O(n 2 ) O(n * log n) O(n) O(logn)
-
A political pollster approaches people on the street and asks them to describe their political affiliation. Twenty-eight people describe themselves as Democrats, 25 as Republicans, 8 people provide a...
-
Listed below are a number of hypothetical research hypotheses. For each hypothesis, identify the independent and dependent variable. a. Male drivers are more likely to exhibit road rage behaviors...
-
Listed below are a number of research questions and hypotheses from actual published articles. For each hypothesis, identify the independent and dependent variable. a. The use of color in a Yellow...
Study smarter with the SolutionInn App