zoukankan      html  css  js  c++  java
  • Radix Sort

    To illustrate the radix sort algorithm we will sort the sequence S0 = {32, 100, 11, 554, 626, 122, 87, 963, 265, 108, 9}. We start by distributing elements of S0 by the value of 0-place digit (the one's place):

    bucket 0:  100
    bucket 1:  11
    bucket 2:  32, 122
    bucket 3:  963
    bucket 4:  554
    bucket 5:  265
    bucket 6:  626
    bucket 7:  87
    bucket 8:  108
    bucket 9:  9


    Stitch the bucket lists to create S1 = {100, 11, 32, 122, 963, 554, 265, 626, 87, 108, 9}. Distribute elements of S1 by the value of 1-place digit (the ten's place):

    bucket 0: 100, 108, 9
    bucket 1: 11
    bucket 2: 122, 626
    bucket 3: 32
    bucket 4:
    bucket 5: 554
    bucket 6: 963, 265
    bucket 7:
    bucket 8: 87
    bucket 9:


    Stitch the bucket lists to create S2 = {100, 108, 9, 11, 122, 626, 32, 554, 963, 265, 87}. Distribute elements of S2 by the value of 2-place digit (the hundred's place):

    bucket 0: 9, 11, 32, 87
    bucket 1: 100, 108, 122
    bucket 2: 265
    bucket 3:
    bucket 4:
    bucket 5: 554
    bucket 6: 626
    bucket 7:
    bucket 8:
    bucket 9: 963


    Stitch the bucket lists to create S3 = {9, 11, 32, 87, 100, 108, 122, 265, 554, 626, 963}. The list is sorted.

  • 相关阅读:
    Test-Driven Development
    单元测试之道(使用NUnit)
    IoC--structuremap
    web.config的configSections节点
    【转】理解POCO
    js的call(obj,arg)学习笔记
    css隐藏滚动条方法
    regexp学习
    asp后台拼接百度ueditor编辑器过程
    php关键词construct和static
  • 原文地址:https://www.cnblogs.com/JasperZhao/p/12812204.html
Copyright © 2011-2022 走看看