Exam 3: A: Algorithms

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

Let f(n)=3n2+8n+7. Show that f(n) is O(n2). Find C and k from the definition. f ( n ) = 3 n ^ { 2 } + 8 n + 7 \text {. Show that } f ( n ) \text { is } O \left( n ^ { 2 } \right) \text {. Find } C \text { and } k \text { from the definition. }

(Short Answer)
4.9/5
(37)

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.

(Essay)
4.9/5
(32)

List all the steps that bubble sort uses to sort 8, 20, 13, 16, 9

(Essay)
4.9/5
(33)

Describe an algorithm that takes a list of n integers (n1)( n \geq 1 ) and finds the location of the last even integer in the list, and returns 0 if there are no even integers in the list.

(Essay)
4.8/5
(36)

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!1 , \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.8/5
(40)

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!1 , \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
(32)

Use the definition of big-O to prove that 12+22++n2 is O(n3)1 ^ { 2 } + 2 ^ { 2 } + \cdots + n ^ { 2 } \text { is } O \left( n ^ { 3 } \right)

(Short Answer)
4.7/5
(38)

Show that j=1n(j3+j) is O(n4)\sum _ { j = 1 } ^ { n } \left( j ^ { 3 } + j \right) \text { is } O \left( n ^ { 4 } \right)

(Short Answer)
4.9/5
(41)

Express a brute-force algorithm that finds the largest product of two numbers in a list a1, a2, . . . , an (n ≥ 2) that is less than a threshold N .

(Essay)
4.8/5
(36)

Prove or disprove that the cashier's algorithm for making change always uses the fewest coins possible when the denominations available are 1-cent coins, 8-cent coins, and 20-cent coins.

(True/False)
4.8/5
(34)

Give a big-O estimate for the number of operations (where an operation is an addition or a multiplication) used in this segment of an algorithm: Give a big-O estimate for the number of operations (where an operation is an addition or a multiplication) used in this segment of an algorithm:

(Short Answer)
4.7/5
(36)

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!1 , \log _ { 2 } n , n , n \log _ { 2 } n , n ^ { 2 } , n ^ { 3 } , \ldots , 2 ^ { n } , n ! -A binary search of n elements.

(Short Answer)
4.9/5
(41)

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

(Short Answer)
4.8/5
(27)

assume that the number of multiplications of entries used to multiply a p × q and a q × r matrix is pqr. -What is the best order to form the product ABC if A, B and C are matrices with dimensions 8 × 3, 3 × 6 and 6 × 12, respectively?

(Essay)
4.8/5
(23)
Showing 41 - 54 of 54
close modal

Filters

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