Basics Flashcards

(35 cards)

1
Q

Can the Fibonacci sequence be implemented Iteratively?

A

Yes

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

Can a function to find a Factorial n! be implemented Iteratively?

A

Yes

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

Which functions of Binary Search Trees can be implemented Iteratively?

A

search(), insert(), delete()

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

Can the value of a Binomial Coefficiant be found using an Iterative algorithm?

A

Yes

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

Can the Towers of Hanoi problem be solved Iteratively?

A

No

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

Which functions of a Binary Search Tree must be implemented Recursively, and why?

A

Traversals and size, because the algorithm needs to see the entire tree

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

What are the key goals of a Constraint Satisfaction problem?

A

Finding no solution, or one/more solutions

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

What are the key goals of a Constraint Optimization problem?

A

Maximizing or minimizing something

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

How many comparisons are there in a Brute Force approach to sorting a collection of n items?

A

n!(n-1) comparisons

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

What is a basic Brute Force approach to sorting a collection of n items?

A

Generate all possible sequences of the n items, check linearly if sorted by comparing adjacent pairs

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

With an algorithmic sorting approach, what is the Worst Case Big-O, and what algorithms fall in this category?

A

O(n^2), Bubble, Selection, Insertion, Quick

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

With an algorithmic sorting approach, what is the Best Case Big-O, and what algorithms fall in this category?

A

O(n logn), Quick, Merge, Heap

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

In a Binary Search Tree, how are the children arranged?

A

Left child is always smaller than the parent, right child is always larger than the parent

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

In a Binary Search Tree, how do you find a parent’s successor?

A

The next alphabetically: Smallest value in right subtree, or largest value in left subtree

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

What happens if the root of a Binary Search Tree is deleted?

A

It is replaced with its successor, and the other branches are moved up in the case of gaps

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

What is the sum of integers from 1 to n?

17
Q

What is the sum of EVEN integers from 2 to 2n?

18
Q

What is the sum of ODD integers from 1 to 2n-1?

19
Q

What is the sum of a Geometric Series?

A

[a^n+1 - 1]/[a - 1]

20
Q

What is the common form of a Geometric Series?

A

1 + a + a^2 + a^3 + … + a^n

21
Q

What is log(m) + log(n)?

22
Q

What is log(m) - log(n)?

23
Q

What is log(m^n)?

24
Q

What is log_c(m)/log_c(A)?

25
What is A^[log_A(m)]?
m
26
What is A^m + A^n?
A^[m +n]
27
What is A^m / A^n?
A^[m - n]
28
What is [A^m]^n ?
A^[nm]
29
What is (AB)^m ?
A^m B^m
30
What is A^-m?
1/A^m
31
What is A^[m/n]?
root_n(A^m)
32
What is a full tree?
A tree where each node has either 0 or 2 children
33
What is a perfect tree?
A full tree where every internal node has two children
34
How many internal and leaf nodes does a perfect tree have?
x-1 internal nodes, and x leaf nodes
35
How many internal and leaf nodes are there in a decision tree?
n! - 1 internal nodes, and n! leaf nodes, where n is the number of variables