什么是&QUOT的意义

什么是&QUOT的意义

本文介绍了什么是&QUOT的意义;稳定"和"稳定"各种排序算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能解释有关各种排序算法稳定和不稳定的意思>怎么能确定算法是否稳定与否,也不稳定的排序算法通常有哪些应用程序(因为它们是不稳定的)?

Can someone explain what "stable" and "unstable" mean in relation to various sorting algorithms> How can one determine whether an algorithm is stable or not, and what applications do unstable sorting algorithms usually have (since they are unstable)?

推荐答案

如果一个排序算法被说成是不稳定,这意味着该排名相同的任何物品,拴成员的顺序并不保证保持不变,在连续的各种各样的收藏。对于稳定的排序中,并列项将永远结束​​在排序时的顺序相同。

If a sorting algorithm is said to be "unstable", this means that for any items that rank the same, the order of the tied members is not guaranteed to stay the same with successive sorts of that collection. For a 'stable' sort, the tied entries will always end up in the same order when sorted.

有关的应用的例子中,快速排序算法是不稳定的。这将做工精细的东西,如排序操作按优先级(如果两个动作都是平等的优先级,你就不太可能去关心它的搭配元素首先执行)。

For an example of applications, the quick sort algorithm is not stable. This would work fine for something like sorting actions by priority (if two actions are of equal priority, you would not be likely to care about which elements of a tie are executed first).

有一个稳定的排序算法,在另一方面,有利于像一个领先的在线游戏。如果你使用一个不稳定的排序,由点排序(例如),然后查看网页上的排序结果,用户可能想通过结果进行分页不能正常利用网页刷新不同的结果和运营。

A stable sorting algorithm, on the other hand, is good for things like a leaderboard for an online game. If you were to use an unstable sort, sorting by points (for instance), then a user viewing the sorted results on a webpage could experience different results on page refreshes and operations like paging through results would not function correctly.

这篇关于什么是&QUOT的意义;稳定"和"稳定"各种排序算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 02:08