Search⌘ K
AI Features

Searching Algorithms

Explore the fundamental searching algorithms used in computer science, including sequential and binary search. Understand how to implement these algorithms in Java to efficiently locate values in arrays. This lesson helps you grasp core concepts and coding techniques crucial for acing your AP Computer Science exam.

We'll cover the following...

Overview

One of the main advantages a computer offers is storing large amounts of data. Computers can find things quicker than humans. This capability is called searching. There are two main types of searching techniques:

  • Sequential search
  • Binary search

Sequential search

Going through all items, one by one, until we find the desired item is called a sequential search. It is also known as a linear search.

For example, if we have the following array, and we need to find 55 ...