2020-12-24

在这里插入图片描述
We add a dummy NO + 1thO element, which we’ll call ProbablyFalseO. ProbablyFalseO
satisfies PfalseO < ProbablyFalseO < MaybeO. Partition the array around ProbablyFalseO as in
the previous exercise. Suppose that after the partition, ProbablyFalseO winds up in position
iO. Then place the element that is in the NO + 1thO slot in position iO, place ProbablyTrueO
(defined the obvious way) in position NO +1 , and partition the subarray from position iO
onward. Finally, swap ProbablyTrueO with the element in the NO + 1thO location. The first NO
elements are now correctly arranged. These two problems can be done without the assumption of an extra array slot; assuming so simplifies the presentation.

我们添加了一个虚拟的NO + 1thO元素,我们可能将其称为lyfalseo。可能falseo满足PfalseO <ProbablyFalseO & lt;MaybeO。在前面的练习中,可能围绕falseo对数组进行分区。假设在划分之后,falseo可能会在iO位置结束。然后将NO + 1thO插槽中的元素放置在iO位置,可能将trueo(明显的定义方式)放置在NO +1位置,并从iO位置开始划分子数组。最后,可能将trueo与NO + 1thO位置中的元素交换。第一个NO元素现在被正确排列了。这两个问题都可以在没有额外数组插槽的情况下解决;这样的假设简化了演示。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值