概率疑点
我正在解决一个问题—— 有一组最初无序的数字。目标是对其进行排序。排序应该通过打乱数字直到它们落入正确的位置来完成(是的,Bogosort'ish :))打乱有一个优化,如果打乱后,任何靠近列表开头或结尾的元素都会落入其中它们的正确位置,这些元素将被固定,其余元素将使用上述相同的逻辑进行洗牌。问题是计算对最初无序的一组数字(例如 6)进行排序所需的平均 f 次洗牌次数。 我知道它是沿着概率线的分布序列,但无法将其完全归零。任何正确方向或方法的建议/建议将不胜感激。
谢谢
Im working on a problem that goes as --
There is a an initially unordered set of numbers. and the goal is to sort it. the sorting should be done by shuffling the numbers until they fall into their correct places(Yeah, Bogosort'ish :)) The shuffling has one optimization that if after a shuffling, any elements towards the beginning or towards the end of the list fall in their correct places, these elements will be fixed and the remaining elements will be shuffled using the above same logic. The problem is to calculate the average number f shuffles required to sort an initially unordered set of numbers, say 6.
I know its a distribution sequence along the line of probability but am not able to completely zero in on it. Any suggestions/advise in the correct direction or approach would be greatly appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可以递归计算。
这可以写成:
您可以通过将输入减少到已经解决的较小输入来继续以这种方式获得更大的输入。
This can be calculated recursively.
This cna be written as:
You can continue in this way to larger inputs by reducing them to the smaller inputs that you have already solved.