资源 · 指南或文章
Linear Search
线性查找的基本定义:按顺序检查每个元素,直到找到匹配项或到达列表末尾。适合零基础的初学者。
审核日期
打开原站: Linear Search (在新标签页中打开原网站)添加到路线图
把这个资源放进你正在跟进的路线图。它会作为你自己的补充资源显示;路线图的步骤不会改变,也不计入你已记录的步骤。
来源内容语言:英语
Read this in other languages: Português brasileiro. In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. Linear search runs in at worst linear time and makes at most n comparisons, where n is the length of the list. Time Complexity: O(n) - since in worst case we're checking each element exactly once.
PrepKit 概览
本概览由 PrepKit 编辑根据源代码仓库撰写并审核,并非资源本身的文字。
- 适合人群
- 来源未说明适用级别
- 形式
- 参考资料
涵盖内容
- 顺序扫描,最多比较 n 次。
- 时间复杂度 O(n),附一行说明。
使用建议
这是 PrepKit 的学习建议,并非来源的说法。
编写代码,目标不存在时返回 -1,并大声解释在什么情况下线性扫描比先排序更好。
范围与局限
非常单薄,没有变体或练习;外部链接指向维基百科、TutorialsPoint 和 YouTube。附有葡萄牙文版本的链接。
获取方式与形式
GitHub 上的英文 README;免费;出自采用 MIT 许可的 trekhleb/javascript-algorithms 仓库。
PrepKit 于 2026年10月2日 审核。 资源来源提交: 85293e3e2b88
本概览的依据
- src/algorithms/search/linear-search/README.md
收录此条目的页面
订阅 PrepKit 通讯
可选。使用 PrepKit 并不需要订阅。