CH-231-A – Homework8 (Solution)

$ 24.99
Category:

Description

• Submit one ZIP file per homework sheet which contains one PDF file (including pictures,computations, formulas, explanations, etc.) and your source code file(s) with one makefile and without adding executable, object or temporary files.
• The implementations of algorithms has to be done using C, C++, Python or Java.
Problem 8.1 Sorting in Linear Time (15 points)
(a) (3 points) Implement the algorithm for Counting Sort and then use it to sort the sequence < 9,1,6,7,6,2,1 >.
(b) (3 points) Implement the algorithm for Bucket Sort and then use it to sort the sequence < 0.9,0.1,0.6,0.7,0.6,0.3,0.1 >.
(c) (3 points) Given n integers in the range 0 to k, design and write down an algorithm (only pseudocode) with pre-processing time Θ(n+k) for building auxiliary storage, which counts in O(1) how many of the integers fall into the interval [a,b].
Algorithms and Data Structures Course: CH-231-A
(d) (4 points) Given a sequence of n English words of length k, implement an algorithm that sorts them alphabetically in Θ(n). Let k and n be flexible, i.e., automatically determined when reading the input sequence. You can consider k to behave like a constant in comparison with n. Example sequence of words to sort:
< ”word”,”category”,”cat”,”new”,”news”,”world”,”bear”,”at”,”work”,”time” >.
(e) (2 points) Given any input sequence of length n, determine the worst-case time complexity for Bucket Sort. Give an example of a worst-case scenario and the prove corresponding the complexity.
Problem 8.2 Radix Sort (7 points)
Consider Hollerith’s original version of the Radix Sort, i.e., a Radix Sort that starts with the most significant bit and propagates step by step to the least significant bit (instead of vice versa).
(a) (4 points) Implement Hollerith’s original version of the Radix Sort.
(b) (3 points) Determine and prove the asymptotic time complexity and the asymptotic storage space required for your implementation.
How to submit your solutions

Reviews

There are no reviews yet.

Be the first to review “CH-231-A – Homework8 (Solution)”

Your email address will not be published. Required fields are marked *