Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**Please do not copy/paste a solution to this question already asked** I have a general idea of the answer, just need help polishing the edges

image text in transcribed

**Please do not copy/paste a solution to this question already asked** I have a general idea of the answer, just need help polishing the edges

part a), I know we would have to manipulate the input by using/assigning a key to each element and such that Counting can be used to sort the keys....Just need to make sure that the manipulation does not have a cost higher than then a straight sorting algorithm with nlogn complexity. Please use this theory to answer.

part b) radix sort with counting sort built in would work.

Exercise 1 (30 points) Counting Sort COUNTING-SORT (A. B.k) 1 let C[0..k] be a new array 2 fori - 0 to k 4 for j = l to A. length 6 [i] now contains the number of elements equal to i 7 for i= l to k 9 [i] now contains the number of elements less than or equal to i 10 for j - A.length downto 1 Suppose that we are given a sequence A of n positive real numbers (ai, an, an) to sort a) 2 points) Can you use Count Sort AS IS to sort A? Explain b) (28 points) How can you adapt Counting Sort to sort the sequence A? Clearly state your assumptions and describe clearly using pseudocode your new Counting Sort algorithm Exercise 1 (30 points) Counting Sort COUNTING-SORT (A. B.k) 1 let C[0..k] be a new array 2 fori - 0 to k 4 for j = l to A. length 6 [i] now contains the number of elements equal to i 7 for i= l to k 9 [i] now contains the number of elements less than or equal to i 10 for j - A.length downto 1 Suppose that we are given a sequence A of n positive real numbers (ai, an, an) to sort a) 2 points) Can you use Count Sort AS IS to sort A? Explain b) (28 points) How can you adapt Counting Sort to sort the sequence A? Clearly state your assumptions and describe clearly using pseudocode your new Counting Sort algorithm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions

Question

What is economic rent? How does it differ from economic profit?

Answered: 1 week ago

Question

Explain the factors influencing wage and salary administration.

Answered: 1 week ago

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago