Fundamentals of algorithms Flashcards
1
Q
How does linear search work?
A
Searches throughout the array one by one
2
Q
How does binary search work?
A
in chronological order, we split the array in half and if the number is smaller than the initial value we disregard that set and repeat until we find the value
3
Q
How does merge sort work?
A
- Split array into halves and then quarters
- Split until it cannot be divided
- combine together from 2’s to 4’s and swap if values are bigger until in chronological order
4
Q
How does bubble sort work?
A
go through two elements at a time and swap if number is smaller until in chronological order.