Skip to content

Array algorithms: max, count, search, average · ⁨数组算法:最大值、计数、查找、平均⁩

English

Four classic array jobs

  • Most array work is one of four scans: find the maximum, count matches, search for a value, or take an average.
  • Each one is a single for loop over the array, with a variable that remembers something.
  • Once you know these four, most array problems are a small change to one of them.
中文

数组的四个经典任务

  • 大多数数组操作都是四种扫描之一:找最大值、计数、查找某个值,或求平均值。
  • 每一种都是对数组的一次 for 循环,加上一个记住某样东西的变量。
  • 一旦掌握了这四种,大多数数组问题都只是在其中之一上做点小改动。

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩