Exam 3: Algorithms

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

Show that f(x)=(x+2)log2(x2+1)+log2(x3+1) is O(xlog2x)f ( x ) = ( x + 2 ) \log _ { 2 } \left( x ^ { 2 } + 1 \right) + \log _ { 2 } \left( x ^ { 3 } + 1 \right) \text { is } O \left( x \log _ { 2 } x \right)

(Short Answer)
4.9/5
(32)

Describe in words how the binary search works.

(Short Answer)
4.8/5
(29)

assume that the number of multiplications of entries used to multiply a p × q and a q × r matrix is pqr. -What is the most efficient way to multiply the matrices A1,A2,A3 of sizes 20×5,5×50,50×5 ? \mathbf { A } _ { 1 } , \mathbf { A } _ { 2 } , \mathbf { A } _ { 3 } \text { of sizes } 20 \times 5,5 \times 50,50 \times 5 \text { ? }

(Short Answer)
4.9/5
(37)

In questions find the "best" big-O notation to describe the complexity of the algorithm. Choose your answers from the following: 1, log2n,n,nlog2n,n2,n3,,2n,n!\log _ { 2 } n , n , n \log _ { 2 } n , n ^ { 2 } , n ^ { 3 } , \ldots , 2 ^ { n } , n ! -The best-case analysis of a linear search of a list of size n (counting the number of comparisons).

(Short Answer)
4.9/5
(40)

Arrange the following functions in a list so each is big- OO of the next one in the list: log n2n ^ { 2 } , log log n,nn , n log nn log(n2+1),log2n\log \left( n ^ { 2 } + 1 \right) , \log 2 ^ { n }

(Short Answer)
4.9/5
(33)

Find the  best big- O function for x3+7x3x+1\text { best big- } O \text { function for } \frac { x ^ { 3 } + 7 x } { 3 x + 1 } \text {. }

(Short Answer)
4.8/5
(37)

Find all pairs of functions in this list that are of the same order: n2+logn,2n+3n,100n3+n2,n2+2nn ^ { 2 } + \log n , 2 ^ { n } + 3 ^ { n } , 100 n ^ { 3 } + n ^ { 2 } , n ^ { 2 } + 2 ^ { n } , n2+n33n3+2nn ^ { 2 } + n ^ { 3 } \cdot 3 n ^ { 3 } + 2 ^ { n }

(Short Answer)
4.7/5
(44)

You have supplies of boards that are one foot, five feet, seven feet, and twelve feet long. You need to lay pieces end-to-end to make a molding 15 feet long and wish to do this using the fewest number of pieces possible. Explain why the greedy algorithm of taking boards of the longest length at each stage (so long as the total length of the boards selected does not exceed 15 feet) does not give the fewest number of boards possible.

(Short Answer)
4.9/5
(42)

In questions find the best big-O function for the function. Choose your answer from among the following: 1, log2n,n,nlog2n,n2,n3,,2n,n!\log _ { 2 } n , n , n \log _ { 2 } n , n ^ { 2 } , n ^ { 3 } , \ldots , 2 ^ { n } , n ! - g(n)=1+3+5+7++(2n1)g ( n ) = 1 + 3 + 5 + 7 + \cdots + ( 2 n - 1 )

(Short Answer)
4.9/5
(38)

Prove that 5x4+2x31 is Θ(x4)5 x ^ { 4 } + 2 x ^ { 3 } - 1 \text { is } \Theta \left( x ^ { 4 } \right)

(Short Answer)
4.8/5
(36)

In questions find the "best" big-O notation to describe the complexity of the algorithm. Choose your answers from the following: 1, log2n,n,nlog2n,n2,n3,,2n,n!\log _ { 2 } n , n , n \log _ { 2 } n , n ^ { 2 } , n ^ { 3 } , \ldots , 2 ^ { n } , n ! -An algorithm that prints all subsets of size three of the set {1, 2, 3, . . . , n}.

(Short Answer)
4.8/5
(47)

Express a brute-force algorithm that finds the second largest element in a list a1, a2, . . . , an (n ≥ 2) of distinct integers by finding the largest element, placing it at the beginning of the sequence, then finding the largest element of the remaining sequence.

(Essay)
5.0/5
(29)
Showing 41 - 52 of 52
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)