Time complexity if keys are distributed uniformly over

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: rt: Complexity Memory Memory complexity: O(n) ! Time complexity: ! – If keys are distributed uniformly over all m If buckets buckets and there is only about one record per bucket, complexity is O(n) – Otherwise it can be up to O(n2) if simple Otherwise simple insertion sort is used to sort buckets and there are O(n) records in at least one of the records buckets buckets 8 Bucket Sort comments ! Most Most important disadvantage of bucket sort: sort: – Requires additional memory – Requires a hash function – Works well only for almost uniformly Works distributed distributed input ! Most important advantage of bucket sort: – Can have time complexity O(n) for unsorted Can for input input 9 Radix Sort Based Based on the values of the actual digits in the pos...
View Full Document

This document was uploaded on 03/06/2014 for the course ECE 368 at Purdue University-West Lafayette.

Ask a homework question - tutors are online