(The original paper was written before cached memory was in common use.) american_flag_sort(Array, Radix) for each digit D: # first pass: compute counts Counts <- zeros(Radix) for object X in Array: Counts += 1 # compute bucket offsets Offsets <- ) for i in 1..Radix] # swap objects into place for object X in Array: swap X to the bucket starting at Offsets for each Bucket: american_flag_sort(Bucket, Radix) This example written in the Python programming language will perform American flag sort for any radix of 2 or greater.
دير يا زود صدامون را ميشنوهWikiMatrix WikiMatrix