O(n)的排序算法可能吗? [英] O(n) sorting algorithm possible?

查看:393
本文介绍了O(n)的排序算法可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是一个简单的算法来小整数排序,但它必须是O(N)。

Just a simple algorithm to sort small integers, but it must be O(n).

推荐答案

一个基数排序是一种方法这是 O(N)。既然你要处理的小整数,应该不会太难实现。

A radix sort is one approach that's O(n). Since you're dealing with small integers, it shouldn't be too hard to implement.

这篇关于O(n)的排序算法可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆