Big o nation Flashcards
1
Q
Linear Search Code
A
time: O(n), space: O(1)
2
Q
Binary Search Code
A
O(log n),space: O(1)
3
Q
Bubble Sort Code
A
Time Complexity: O(n²)
Space Complexity: O(1)
4
Q
Selection Sort Code
A
Time Complexity: O(n²)
Space Complexity: O(1)
5
Q
Insertion Sort Code
A
Time Complexity: O(n²)
Space Complexity: O(1)
6
Q
QuickSort Code
A
Time Complexity: O(nlog2(n)) on average, O(n²) for worst case
Space Complexity: O(log2(n))
7
Q
Quickselect Code
A
Time Complexity: O(n).
Space Complexity: O(n) for recursion call stack in worst case. On average : O(Log n)
8
Q
Mergesort Code
A
Time Complexity: O(nlog2(n))
Space Complexity: O(n)
9
Q
Count Sort Code
A
Time Complexity: O(n + k) where k is the range of the input.
Space Complexity: O(k)
9
Q
Binary tree
A
Time: O(logn), Space: O(logn)