Things from notes Flashcards
C(n, 2) = ?
Without any factorials
2
How many comparisons does an algorithm that finds duplicates in an array?
C(n, 2)
Comparisons needed to find the max value in an array?
n-1
Comparisons needed in a bubble sort?
C(n, 2)
Factorial notation for C(n, k)
k!(n-k)!
Factorial notation for P(n, k)
(n-k)!
Comparisons on n elements for search?
n
Comparisons on n elements for BSearch?
log2n + 1
General type of decomp recursions for:
Build a fractal like Koch snowflake
Bottom up
General type of decomp recursions for:
Binary search and merge
Divide and conquer
General type of decomp recursions for:
Reverse a string by moving last element to from, recurse on rest
Top Down
General type of decomp recursions for:
Check if a string is a palindrome
edge and middle
General type of decomp recursions for:
Calculate the factorial of n as a recursive program taking a single formal parameter.
Top Down
General type of decomp recursions for:
Reverse characters in an array in place.
Edges and middle
Closed form solution for the sum of n positive integers?
2