Big-O Flashcards
Bubble Sort Run Time
O(n2)
Selection Sort Run Time
O(n2)
Linear Search Run Time
O(n)
Binary Search
O(log n)
avg linear checks
n/2
avg binary checks
2^n
Runtime represents…
the amount of work done on the program
.this refers to the…
instance variable
How does selection sort work?
finds the smallest and moves it to the first point, then continues the process
How does bubble sort work?
compares first point to the point to the right of it, and swaps with it if it is smaller, then continues the process with the new number.
How does linear search work?
Starts from the beginning and continues until the key is found
How does binary search work?
Starts in the middle and continues either to the left or to the right until the key is found