Algorithms Flashcards

1
Q

Big O notation

A
Constant:O(1)
Logarithms:O(log n)
Liner:O(n)
Polynomial:O(n^k)
Exponential:O(k^n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Dijkstra’s algorithm

A

Finds the shortest path between two points

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

How does insertion sort work?

A

sorted list and unsorted listed

the first item from the unsorted list is compared to the first item from the unsorted listed.

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

How does bubble sort work?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does Linear search work?

A

The linear search involves methodologically searching one location after another until the searched-for value is found. Starts at the beginning

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

How does binary search work?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How does quick sort work?

A

bn

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