Searching Algorithms Flashcards
Which searching algorithm requires data to be sorted before starting?
Binary search
Which example shows linear search?
C
Perform a linear search for 9 on the values 1 3 6 7 9 12 15.
The linear search will find 9 at the 4th position in the array.
What is the time complexity of binary search?
O(log n)
Which example shows binary search?
B
Perform a binary search for 6 on the values 1 3 6 7 9 12 15.
The binary search will find 6 at the 3rd position in the array.
Which searching algorithm has a time complexity of O(n)?
Linear search.
Front
Back
Which searching algorithm requires data to be sorted before starting?
Binary search
Which example shows linear search?
C
Perform a linear search for 9 on the values 1 3 6 7 9 12 15.
The linear search will find 9 at the 4th position in the array.
What is the time complexity of binary search?
O(log n)
Which example shows binary search?
B
Perform a binary search for 6 on the values 1 3 6 7 9 12 15.
The binary search will find 6 at the 3rd position in the array.
Which searching algorithm has a time complexity of O(n)?
Linear search.