Searching Algorithms Flashcards
1
Q
Linear Search
A
looks through a list of items and finds if a value is in the list. It checks every item in the list and compares it to the search item
2
Q
Binary Search
A
Works by splitting the list in two until the item is found
3
Q
Name 4 advantages of linear search..
A
Simple to code
Quite efficient for short lists
Doesn’t requires ordered data
Helps for algorithms such as max/min
4
Q
Name 1 disadvantage of linear search
A
Very slow on large lists
5
Q
Name 1 advantage of binary search
A
Fast on any length of list
6
Q
Name 2 disadvantages of binary search
A
Complex code
Data has to be ordered