big o Flashcards
(23 cards)
QUICK SORT
worst case time complexity?
worst case space complexity?
time - O(n^2)
space - O(log(n))
MERGE SORT
worst case time complexity?
worst case space complexity?
time - O(n log(n))
space - O(n)
BUBBLE SORT
worst case time complexity?
worst case space complexity?
time - O(n^2)
space - O(1)
INSERTION SORT
worst case time complexity?
worst case space complexity?
time - O(n^2)
space - O(1)
SELECTION SORT
worst case time complexity?
worst case space complexity?
time - O(n^2)
space - O(1)
LINEAR SEARCH
worst case time complexity?
time - O(n)
BINARY SEARCH
worst case time complexity?
time - O(log(n))
what is the relationship between input size and execution time for O(1)?
always executes in the same time regardless of the size of the data set
what is the relationship between input size and execution time for O(log(n))?
execution time increase is linear when input size is doubled
what is the relationship between input size and execution time for O(n)?
execution time is proportional to the input size increase
what is the relationship between input size and execution time for O(n^x)?
execution time increases relating to the highest degree of the polynomial complexity as the input size increases
what is the relationship between input size and execution time for O(2^n)?
execution time increases exponentially as the input size increases
what is the relationship between input size and execution time for O(n!)?
execution time increases in a factorial nature related to the input size
what is the worst time complexity described by big O notation?
O(n!) or factorial time complexity
what is the best time complexity described by big O notation?
O(1) or constant time complexity
what feature of an algorithm commonly has O(log(n))?
divide and conquer / halving the input size with every pass
what feature of an algorithm commonly has O(n)?
iterating through the size of the input
what feature of an algorithm commonly has O(n^x)?
nested loops, each loop relating to the input size
what feature of an algorithm commonly has O(2^n)?
recursive functions
what feature of an algorithm commonly has O(n!)?
trial and error / guessing until a condition is met
what is the domain of an algorithm?
all possible inputs into the algorithm
what is the codomain of an algorithm?
all possible outputs of an algorithm
what is the range of an algorithm?
all of the actual outputs of an algorithm