zuai-logo
zuai-logo
  1. AP Computer Science A
FlashcardFlashcard
Study GuideStudy GuideQuestion BankQuestion Bank

What are the differences between Linear Search and Binary Search?

Linear Search: Works on unsorted data, O(n) time complexity. | Binary Search: Requires sorted data, O(log n) time complexity.

Flip to see [answer/question]
Flip to see [answer/question]
Revise later
SpaceTo flip
If confident

All Flashcards

What are the differences between Linear Search and Binary Search?

Linear Search: Works on unsorted data, O(n) time complexity. | Binary Search: Requires sorted data, O(log n) time complexity.

How is Linear Search applied in real-world scenarios?

Searching for a specific product in a small online store inventory, finding a specific contact in a small phone book, or searching for a file in a directory.

What is the definition of Linear Search?

A searching algorithm that sequentially checks each element in a list until the target element is found or the list is exhausted.

What is the definition of Sequential Search?

A searching algorithm that sequentially checks each element in a list until the target element is found or the list is exhausted.

What is the definition of an ArrayList?

A resizable array implementation of the List interface.

What is the definition of 'index' in the context of searching?

The position of an element within a list or array.

What does it mean to 'search' in the context of data structures?

To find a specific element within a data structure and potentially return its location.

What is the return value if an element is not found in Linear Search?

-1