Flashcards on Linear and binary search

Linear and Binary Search: Algorithms Explained for Students

1 / 12

What is the fundamental operation in computer science that involves finding a specific item within a collection?

Searching

Tap to flip · Swipe to navigate

Search Algorithms

12 cards

Card 1

Question: What is the fundamental operation in computer science that involves finding a specific item within a collection?

Answer: Searching

Card 2

Question: What are the two primary search algorithms discussed?

Answer: Linear search and binary search

Card 3

Question: What is another name for linear search?

Answer: Sequential search

Card 4

Question: Describe the principle of linear search.

Answer: It examines each element in a list one by one, in sequential order, starting from the beginning, until the target item is found or the entire list has

Card 5

Question: Does linear search require the list to be sorted?

Answer: No, it works equally well on both sorted and unsorted data.

Card 6

Question: What is the best-case time complexity for linear search?

Answer: O(1)

Card 7

Question: When does the best-case scenario for linear search occur?

Answer: The target element is the first element in the list.

Card 8

Question: What is the worst-case time complexity for linear search?

Answer: O(N)

Card 9

Question: When does the worst-case scenario for linear search occur?

Answer: The target element is the last element in the list, or it is not present at all.

Card 10

Question: What is the average-case time complexity for linear search?

Answer: O(N)