Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose you are a teacher at a university. You have to assign a letter grade to each student based on his or her unique

Suppose you are a teacher at a university. You have to assign a letter grade to each student based on his or

Suppose you are a teacher at a university. You have to assign a letter grade to each student based on his or her unique total score. Scores can only be compared to each other. You are grading on a curve, and there are a total of k different grades possible. You want to rearrange the students into k equally sized groups such that everybody in the top group has a higher score than everybody in the second group, and so forth. However, you do not care how students are ordered within each group (because they will all receive the same grade). 1. Describe and analyze an algorithm that takes an unsorted n-element array A of unique scores and an integer k, and divides A into k equally sized groups as described above. Your algorithm should run in time O(nk). You may assume that n is divisible by k, but note that k is an input into the algorithm, not a fixed constant. 2. In the case that k =n, prove that any algorithm to solve this problem must run in time (n log k) in the worst case. Recall that we are only considering comparison-based algorithms, i.e., algorithms that only compare scores to each other as a way of finding information about the input. Hint: this should be a very short proof. 3. Now describe and analyze an algorithm for this problem that runs in time O(n log k). You may assume that k is also a perfect power of 2, in addition to your assumption that n is a multiple of k.

Step by Step Solution

3.37 Rating (175 Votes )

There are 3 Steps involved in it

Step: 1

1 Algorithm for Onk time complexity First sort the array A in nondecreasing order Next initialize an ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Analytics Communicating With Numbers

Authors: Sanjiv Jaggia, Alison Kelly, Kevin Lertwachara, Leida Chen

1st Edition

978-1260785005, 1260785009

More Books

Students also viewed these Programming questions

Question

=+ What do we do best?

Answered: 1 week ago

Question

How can NAFTA be beneficial to suppliers of Walmart?

Answered: 1 week ago

Question

Briefly describe computer- assisted approaches to production.

Answered: 1 week ago

Question

Why is management of technology important?

Answered: 1 week ago