关于Fire sort算法
  • 板块灌水区
  • 楼主phieeeeee
  • 当前回复0
  • 已保存回复0
  • 发布时间2025/2/1 17:56
  • 上次更新2025/2/1 23:23:06
查看原帖
关于Fire sort算法
1572412
phieeeeee楼主2025/2/1 17:56

刷视频看到了一个效率极低的排序算法,fire sort。然后查了一圈也没查到相关资料,只在评论区里看到了下面一段话:

Fire Sort is an impractical variant of Gnome Sort that forces a worst case.

Consider that the equation S = 0.5N^2 - 0.5N represents the number of swaps

needed, variable S, for the Gnome process to reverse any list of length N

values. Fire abuses this case by tracking the number of swaps that have

been made. When this count reaches T, an incrementing check number, then it

changes this limit by N. The Gnome process will continue, but in reverse.

Once the swap tracking reaches the new T value, the limit changes by N, and

the Gnome direction reverses again.Where Fire Sort increments the swap check value by the length of the list,

Stupid Fire Sort only changes it by 1. This tiny difference lands the total

number of needed swaps, variable S, to reverse a list of N count values at

an unimaginable S = 0.125N^4 - 0.25N^3 + 1.125N^2 - N.

机翻下来是这样的:

Fire Sort是Gnome Sort的一个不切实际的变体,它强制执行最坏的情况。 考虑方程S=0.5N^2-0.5N表示交换次数 Gnome进程需要变量S来反转任何长度为N的列表 价值观。Fire通过追踪具有以下特征的掉期数量来滥用此案 已制作。当该计数达到T(一个递增的校验号)时 将此限制更改为N。Gnome进程将继续,但方向相反。 一旦掉期跟踪达到新的T值,限制就会改变N,以及 侏儒的方向再次反转。其中,Fire Sort将交换校验值增加列表的长度, 愚蠢的火排序只会将其更改1。这个微小的差异使总数 所需的交换次数,变量S,用于反转N个计数值的列表 一个难以想象的S=0.125N^4-0.25N^3+1.125N^2-N。

有点看不懂,有无大佬点拨

2025/2/1 17:56
加载中...