Binary and Linear Search Flashcards

1
Q

What is a Linear Search and how does it work?

A

Finds an item unsorted and sorted lists, starts at first item in the line and checks each 1 by 1 effective for small data sets not large ones

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Pseudocode for Linear Search

A
Found = False
Index = 0
While found == False and index < items. Lenth
 If items[index] == item_to_find then
 Found = True
 Else
   Index = Index + 1
End if
End While
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Binary Search

A

Efficient algorithm finding item in sorted data set, starts in the middle and repeatedly divides itself in half best for large data sets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly