CS 502 Quiz # 2
1) In quick sort algorithm, we choose pivot _____________
- Greater than 5
- Randomly
- Less than 5
- Always the smallest element
2) We can use the ____________ property to devise a recursive formation of the edit distance problem.
- Algorithmic
- Real
- Small substructure
- Optimal substructure
3) Selection sort is a _________ sorting algorithm.
- Stable
- Not In-Place
- In-partition
- In-Place
4) Dynamic Programming algorithms often use some kind of __________ to store the results of intermediate sub-problems.
- Loop
- Variable
- Table
- Stack
5) Suppose we have 4 matrices A, B, C, D. What is correct expansion of m [1,2] in chain matrix multiplication
- m [1, 2] = m [1, 2] + m [1, 2] + P0. P1. P2
- m [1, 2] = m [1, 1] + m [2, 2] + P0. P1. P2
- m [1, 2] = m [1, 2] + m [2, 2] + P0. P1. P2
- m [1, 2] = m [1, 1] + m [2, 2] + P0. P1. P2
6) In chain matrix multiplication, if there are n items, there are _________ ways in which outer most pair of parentheses can placed
- n+1
- 2n
- N-1
- N^2
7) In Fibonacci Sequence, each term is calculated by ___________ previous __________ terms.
- Adding, Three
- Multiplying, Two
- Subtracting, Two
- Adding, Two
8) Insertion sort is a ___________ sorting algorithm.
- In-place
- Not In-Place
- In-partition
- Unstable
9) If there are Θ ( ) entries in edit distance matrix then the total running time is:
- Θ (1)
- Θ (n log n)
- Θ ( )
- Θ (
10) Consider two matrices A and B, where A is 10*30 and B is 30*40. What is correct number of multiplications requiring to multiply A and B
- 10*30*40
- 30*40
- 10*30
- 30*30