logo
  • 教程列表
  • SO官方文档
  • 计数排序
    • 计算排序基本信息
    • Psuedocode 实施
    • C 实现
  1. StackOverflow 文档
  2. algorithm 教程
  3. 计数排序
  4. Psuedocode 实施

Psuedocode 实施

Created: November-22, 2018

约束:

  1. 输入(要排序的数组)
  2. 输入中的元素数(n)
  3. 键在 0..k-1 (k) 范围内
  4. 伯爵(数组)

伪代码:

for x in input:
    count[key(x)] += 1
total = 0
for i in range(k):
    oldCount = count[i]
    count[i] = total
    total += oldCount
for x in input:
    output[count[key(x)]] = x
    count[key(x)] += 1
return output
  • C 实现
  • 计算排序基本信息

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明