OLevel数学​考试算法排序问题!

来源: 互联网 时间:2021-01-08 16:27:34 浏览量: 1289 作者: 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阅读评分等更多信息,大家可以线上咨询我们或继续关注网站更新的文章!


OLevel数学​考试算法排序问题!
分享:
如何强化学校体育 促进学生身心健康全面发展

热门文章

免费获取备考攻略

热门标签