[Solved] CH231A assignment7-Sorting in Linear Time

$25

File Name: CH231A_assignment7-Sorting_in_Linear_Time.zip
File Size: 386.22 KB

SKU: [Solved] CH231A assignment7-Sorting in Linear Time Category: Tag:
5/5 - (1 vote)

  • Implement the algorithm for Counting Sort and then use it to sort the sequence < 9,1,6,7,6,2,1 >.
  • 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 >.
  • 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].
  • 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 >.

  • 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.
  • Bonus Given n 2D points that are uniformly randomly distributed within the unit circle, design and write down an algorithm (only pseudocode) that sorts in linear time the points by increasing Euclidean distance to the circles origin. Write also a pseudocode function for the computation of the Euclidean distance between two 2D points.

Problem 7.2 Radix Sort

Consider Holleriths original version of the Radix Sort, i.e., a Radix Sort that starts with the most significant bit and propagates iteratively to the least significant bit (instead of vice versa).

  • Implement Holleriths original version of the Radix Sort.
  • Determine and prove the asymptotic time complexity and the asymptotic storage space required for your implementation.
  • Bonus Write down the pseudocode for an algorithm which sorts n integers in the range 0 to n3 1 in O(n)

Reviews

There are no reviews yet.

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

Shopping Cart
[Solved] CH231A assignment7-Sorting in Linear Time
$25