Algorithms Flashcards
Big O notation
Constant:O(1) Logarithms:O(log n) Liner:O(n) Polynomial:O(n^k) Exponential:O(k^n)
Dijkstra’s algorithm
Finds the shortest path between two points
How does insertion sort work?
sorted list and unsorted listed
the first item from the unsorted list is compared to the first item from the unsorted listed.
How does bubble sort work?
worst case:O(n^2(squared))
Initial unsorted array
1)Compare first and second if necessary swap
2)compare second and third if necessary swap
3)continue till u reach the end of an array
4)repeat the steps 1-3
How does Linear search work?
The linear search involves methodologically searching one location after another until the searched-for value is found. Starts at the beginning
How does binary search work?
Binary search works by dividing the list into two each time until the item being searched for is found. For binary search to work, the list has to be in order
How does quick sort work?
bn