− | [[File:Binary search vs Linear search example svg.svg|thumb|For looking up a given entry in a given ordered list, both the [[binary search algorithm|binary]] and the [[linear search]] algorithm (which ignores ordering) can be used. The analysis of the former and the latter algorithm shows that it takes at most log<sub>2</sub>(''n'') and ''n'' check steps, respectively, for a list of length ''n''. In the depicted example list of length 33, searching for ''"Morin, Arthur"'' takes 5 and 28 steps with binary (shown in {{color|#008080|cyan}}) and linear ({{color|#800080|magenta}}) search, respectively.]] | + | [[File:Binary search vs Linear search example svg.svg|thumb|For looking up a given entry in a given ordered list, both the [[binary search algorithm|binary]] and the [[linear search]] algorithm (which ignores ordering) can be used. The analysis of the former and the latter algorithm shows that it takes at most log<sub>2</sub>(''n'') and ''n'' check steps, respectively, for a list of length ''n''. In the depicted example list of length 33, searching for ''"Morin, Arthur"'' takes 5 and 28 steps with binary (shown in {{color|#008080|cyan}}) and linear ({{color|#800080|magenta}}) search, respectively. 为了在给定的有序列表中查找给定的条目,可以使用二进制和线性搜索算法(忽略排序)。对前一种算法和后一种算法的分析表明,对于长度为n的列表,它最多只需要log2(n)和n个检查步骤。在所描述的长度为33的示例列表中,搜索“Morin,Arthur”分别需要5步和28步,使用二进制和线性搜索。]] |
− | binary and the linear search algorithm (which ignores ordering) can be used. The analysis of the former and the latter algorithm shows that it takes at most log<sub>2</sub>(n) and n check steps, respectively, for a list of length n. In the depicted example list of length 33, searching for "Morin, Arthur" takes 5 and 28 steps with binary (shown in ) and linear () search, respectively.]] | + | For looking up a given entry in a given ordered list, both the binary and the linear search algorithm (which ignores ordering) can be used. The analysis of the former and the latter algorithm shows that it takes at most log<sub>2</sub>(''n'') and ''n'' check steps, respectively, for a list of length n. In the depicted example list of length 33, searching for "Morin, Arthur" takes 5 and 28 steps with binary and linear search, respectively. |
| 二进制和线性搜索算法(忽略排序)可以使用。对前者和后者的分析表明,对于一个长度 n 的列表,分别采用最多的 log 子2 / sub (n)和 n 个检查步骤。 在长度为33的示例列表中,搜索“ Morin,Arthur”需要5步和28步,分别使用二进制(如图所示)和线性(如图所示)搜索 | | 二进制和线性搜索算法(忽略排序)可以使用。对前者和后者的分析表明,对于一个长度 n 的列表,分别采用最多的 log 子2 / sub (n)和 n 个检查步骤。 在长度为33的示例列表中,搜索“ Morin,Arthur”需要5步和28步,分别使用二进制(如图所示)和线性(如图所示)搜索 |