Basics Flashcards
(35 cards)
Can the Fibonacci sequence be implemented Iteratively?
Yes
Can a function to find a Factorial n! be implemented Iteratively?
Yes
Which functions of Binary Search Trees can be implemented Iteratively?
search(), insert(), delete()
Can the value of a Binomial Coefficiant be found using an Iterative algorithm?
Yes
Can the Towers of Hanoi problem be solved Iteratively?
No
Which functions of a Binary Search Tree must be implemented Recursively, and why?
Traversals and size, because the algorithm needs to see the entire tree
What are the key goals of a Constraint Satisfaction problem?
Finding no solution, or one/more solutions
What are the key goals of a Constraint Optimization problem?
Maximizing or minimizing something
How many comparisons are there in a Brute Force approach to sorting a collection of n items?
n!(n-1) comparisons
What is a basic Brute Force approach to sorting a collection of n items?
Generate all possible sequences of the n items, check linearly if sorted by comparing adjacent pairs
With an algorithmic sorting approach, what is the Worst Case Big-O, and what algorithms fall in this category?
O(n^2), Bubble, Selection, Insertion, Quick
With an algorithmic sorting approach, what is the Best Case Big-O, and what algorithms fall in this category?
O(n logn), Quick, Merge, Heap
In a Binary Search Tree, how are the children arranged?
Left child is always smaller than the parent, right child is always larger than the parent
In a Binary Search Tree, how do you find a parent’s successor?
The next alphabetically: Smallest value in right subtree, or largest value in left subtree
What happens if the root of a Binary Search Tree is deleted?
It is replaced with its successor, and the other branches are moved up in the case of gaps
What is the sum of integers from 1 to n?
n(n+1)/2
What is the sum of EVEN integers from 2 to 2n?
n(n+1)
What is the sum of ODD integers from 1 to 2n-1?
n^2
What is the sum of a Geometric Series?
[a^n+1 - 1]/[a - 1]
What is the common form of a Geometric Series?
1 + a + a^2 + a^3 + … + a^n
What is log(m) + log(n)?
log(m - n)
What is log(m) - log(n)?
log(m/n)
What is log(m^n)?
n log(m)
What is log_c(m)/log_c(A)?
log_A(m)