, ,

[SOLVED] Cs301 homework 2

$25

File Name: Cs301_homework_2.zip
File Size: 150.72 KB

Categories: , , Tags: , ,
5/5 - (1 vote)

Suppose that you are given a set of n numbers. The
goal is to find the k largest numbers in this set, in sorted order. For each method below, identify relevant algorithms with the best asymptotic worst-case running time
(e.g., which sorting algorithm? which order-statistics algorithm?), and analyze the
running time of the overall algorithm in terms of n and k.(a) First sort the numbers using a comparison-based sorting algorithm, and then
return the k largest numbers.(b) First use an order-statistics algorithm to find the k’th largest number, then partition around that number to get the k largest numbers, and then sort these k
largest numbers using a comparison-based sorting algorithm.
Which method would you use? Please explain why.(a) How can you modify the radix sort algorithm for integers, to sort strings? Please explain the modifications.(b) Illustrate how your algorithm sorts the following list of strings
[“V EY SEL00
, “EGE00
, “SELIN00
, “Y ASIN00].Please show every step of your algorithm.(c) Analyze the running time of the modified algorithm
1

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Cs301 homework 2
$25