窝哈网

OLevel数学算法排序问题

发布日期:2020-02-10
文章来源:窝哈O LEVEL
937人浏览

  OLevel数学部分对于我们来说难度不大,甚至可以说是强势科目,但是要想取得OLevel考试高分并不是容易的是,我们除了要熟知OLevel数学的基础知识之外,更需要学习的是数学难题的解题方法,今天我们就来说说OLevel数学算法排序问题。

  Part.1 bubble sort

  在bubble sort中,我们通过比较每两个相邻数字来进行排序。

  ■ 首先介绍一下基本流程:

  Start at the beginning of the list. Pass through the list and compare adjacent values. For each pair of values

  ■ If they are in order, leave them

  ■ If they are not in order, swap them.

  2. When you get to the end of the list, repeat step 1.

  3. When a pass is completed without any swaps, the list is in order.

  从已给列表的最左边开始,比较每两个相邻之间的数字,如果它们有序,保持不变;

  如果没有排好序,交换他们的位置。 当你完成一个pass时,再重复前面的步骤直到我们完成了一个不需要任何交换位置的pass。

  Part.2 quick sort

  在quick sort中,我们选取一个pivot把数据分成两个sub-lists, 大于pivot的和小于pivot的数据。然后再在子表中继续选取pivot分成更多的子表。


OLevel数学算法排序问题


  ■ 基本流程:

  1. Choose the item at the mid-point of the list to be the first pivot.

  2. Write down all the items that are less than the pivot, keeping their order, in a sub-list.

  3. Write down the pivot.

  4. Write down the remaining items (those greater than the pivot) in a sub-list.

  5. Apply steps 1 to 4 to each sub-list.

  6. When all items have been chosen as pivots, stop.

  Part.3 Exam Tips

  ■ Exam Tips:

  1. 看清题目中的要求,descending or ascending。

  2. 在使用bubble sort的时候,注意我们要一直写出一个没有任何swap的pass才可以结束algorithm,不能因为数据已经完成排序就不写出最后的pass。

  3. 在quick sort中,我们选择了pivot之后,我们剩下的数据仍然要按照原本的顺序写入sub-list。

  关于OLevel数学算法排序问题的介绍就总结到这里了,希望大家能够好好的提升备考技巧的基础。如果想要获取OLevel考试时间表、OLevel培训中心等更多信息,大家可以线上咨询我们或继续关注网站更新的文章!


分享到:
相关文章
登录
没有账号?免费注册
注册
已有账号?直接登录
手机号注册邮箱注册
注册
完成注册
找回密码
下一步
重置密码
修改完成,点击登录
图形验证码
验证码
免费获取验证码
设置成功