Sorting3.4 - Loop Invariant The keys have been correctly...

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: Loop Invariant The keys have been correctly stable-sorted with respect to the i-1 least-significant digits. CSE 2011 Prof. J. Elder - 121 - Last Updated: 4/1/10 11:16 AM Running Time CSE 2011 Prof. J. Elder - 122 - Last Updated: 4/1/10 11:16 AM Example 3. Bucket Sort Applicable if input is constrained to finite interval, e.g., [0…1). If input is random and uniformly distributed, expected run time is (n). CSE 2011 Prof. J. Elder - 123 - Last Updated: 4/1/10 11:16 AM Bucket Sort CSE 2011 Prof. J. Elder - 124 - Last Updated: 4/1/10 11:16 AM Loop Invariants Loop 1 The first i-1 keys have been correctly placed into buckets of width 1/n. Loop 2 The keys within each of the first i-1 buckets have been correctly stable-sorted. CSE 2011 Prof. J. Elder - 125 - Last Updated: 4/1/10 11:16 AM ...
View Full Document

This note was uploaded on 02/14/2012 for the course CSE 2011Z taught by Professor Elder during the Fall '11 term at York University.

Ask a homework question - tutors are online