初级Beginner点子Idea

排队大挑战:怎样最快排好序

The Line-Up Race: How to Sort Fast

6 个人走过一张画在地上的“排序网络”,走到终点就排好了。很多比较可以同时进行。

Six kids walk through a sorting network drawn on the ground and arrive in order. Many comparisons can happen at the same time.

这是一个课程点子:活动和资料都有,学习单还没做。

This is a lesson idea: the activities and links are ready, the worksheets are not made yet.

6 个同学手里各拿一个数,怎样最快从小到大排好队?如果每次只能两个人比一比呢?

Six kids each hold a number. What is the fastest way to line up from smallest to largest, if only two people can compare at a time?

孩子做什么What kids do

  1. 在地上画一个“排序网络”:6 个人同时出发,每走到一个方框,两个人比大小,小的走左边、大的走右边。Draw a sorting network on the ground. Six kids start together; at each box, two of them compare, the smaller goes left and the larger goes right.
  2. 计时比赛:一对一对轮流比,和很多对同时比,哪个快?Race the clock: comparing one pair at a time, or many pairs at once. Which is faster?
  3. 换成字母、生日、身高,这个网络还管用吗?Try letters, birthdays or heights. Does the network still work?

要点Key idea

排序是电脑最常做的事之一。很多比较可以同时进行(并行),所以能排得更快。

Sorting is one of the things computers do most. Many comparisons can run at the same time (in parallel), so it goes faster.

和 AI 的关系Where AI comes in

2023 年 DeepMind 的 AlphaDev 用 AI 找到了排 3–5 个数更快的方法,已经放进了全世界程序员都在用的 C++ 标准库。

In 2023 DeepMind’s AlphaDev used AI to find faster ways to sort 3 to 5 numbers, now part of the C++ standard library that programmers everywhere use.

视频与文章Videos and reading

接着学Keep going