Skip to content
English

Searching a list

  • Searching means finding whether a value is in a list, and where.
  • The usual answer is the index of the value, or -1 if it is missing.
  • Two classic methods are linear search and binary search.
中文

在列表中查找

  • 查找(searching)就是判断某个值是否在列表中,以及在哪里。
  • 通常的答案是这个值的索引,如果不存在则返回 -1。
  • 两种经典方法是线性查找和二分查找。

Handout

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

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