Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++, pls do not directly copy and paste code from another source Counting-Sort psuedocode to help with implementation Input 5 3 3 3 3

in C++, pls do not directly copy and paste code from another source

image text in transcribed

Counting-Sort psuedocode to help with implementation

image text in transcribed

Input

5

3 3 3 3 3 2 2 2 2 2

2 3 2 2 2 2 2 2 2 2

1 3 0 0 2 1 0 0 0 0

1 3 0 0 2 2 0 0 0 0

2 3 2 1 2 2 2 2 2 2

Output

1;3;0;0;2;1;0;0;0;0; 1;3;0;0;2;2;0;0;0;0; 2;3;2;1;2;2;2;2;2;2; 2;3;2;2;2;2;2;2;2;2; 3;3;3;3;3;2;2;2;2;2; 
Radixsort Description In this assignment you will implement RadixSort. See the textbook for the pseu- docode. Input structure You are going to apply RadixSort to sort vectors. The input starts with an integer number which indicates the number of vectors to be sorted. Then vectors follow, one vector per line. Each vector consists of 10 numbers where each number has a value in {0, 1, 2, 3). Entries of a vector are separated by a space. Output structure Output the sorted sequence of vectors, one per line. Vector i must appear before vector j in your output if and only if for some d {1, 2, ..., 10}, vector i is smaller than or equal to vector j on the dth entry, and the two vectors are equal for any of the first d-1 entries. Examples of input and output COUNTING-SORT(A, B,k) 1 let C[O..k] be a new array 2 for i = 0 to k 3 C[i] = 0 4 for j = 1 to A.length 5 C[A[;)] = C[Aj l] +1 6 // C[i] now contains the number of elements equal to i. 7 for i = 1 to k 8 C[i] = C[i] + C[i 1] 9 Il C[i] now contains the number of elements less than or equal to i. 10 for j = A.length downto 1 11 B[C[A[;)]] = A[i] 12 C[A[j]] = C[A[j]] - 1

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

Whawhat is DHCP lease?

Answered: 1 week ago