Dis math chp 3
Sort into increasing order the elements in the list 8, -3, 5, 1, 3, 7, 6, 4.
-3, 1, 3, 4, 5, 6, 7, 8
What change is made by the cashier's algorithm for 40 cents using quarters, dimes, and pennies (but no nickels)?
1 quarter, 1 dime, and 5 pennies
Which of the following shifts s are found by the naive string matcher in searching for the pattern is in the text Mississippi?
1, 4
Determine the number of bit operations used to compute the boolean product of A and B, where Aand B are 2×2 zero-one matrices.
16
The number of character comparisons used by the naive string matcher to look for the pattern of in the text love is
4
Which of these rules for selecting a talk from those compatible with talks already scheduled defines a greedy algorithm that always yields the most talks from a given list of possible talks?
Earliest finish time
Using the greedy change-making algorithm, determine the coins required in making change for 46 cents, using quarters, dimes, nickels, and pennies.
One quarter, two dimes, and a penny
Which of these statements is true about worst-case complexity?
Worst-case analysis estimates how many operations an algorithm needs to guarantee that it can find the solution.
Match the function with the best big-O estimate.
(x2 + 1)log(x2 + 1) matches Choice O(x2 log x) (3x2 + (log x)3)(x + (log x)2) matches Choice O(x3) ((log x)2 + 1)(x log x + 1) matches Choice O(x(log x)3) (x + (log x)4)(x + (log x)3) matches Choice O(x2)
For which sets of coin values does the greedy change-making algorithm always make change using the least number of coins? (Select all that apply.)
1, 5, 10, 25, 50, 100 1, 5, 25 1, 5, 10, 25
List these functions so that each function in the list is big-O of the function below it.
1. 1,000,000 2. (log x ) 2 3. 107x + 108 4. x3 +x2 +17 5. 2x 6. 3x
Put the following steps in order to perform a worst-case analysis of bubble sor
1. Bubble sort makes 2. On the /th pass 3. the total nnumber 4.hence
Put the following steps in order for determining the time complexity of the algorithm for finding the maximum element in a sequence of integers. Use the number of comparisons as a measure of time complexity.
1. Each time for the 2.each time for the if 3. one more comparison 4. the total number 5. since f(n)
Order the steps to produce an analysis of the time complexity of binary search in terms of the number of comparisons used. You can assume that there are n = 2k elements in the list.
1. Each time the 2. The loop is exe 3.When the loop exist 4.Hence at the most 5. Hence the compl
Arrange the steps in order to show that 4x5 + 16x2 log x is Θ(x5).
1. To establish the big 2.If x > 1 3. Hence, 4x5 4.consequently, 4x.. with witness 5.x5 is o 6. consequently
Arrange the steps below to prove that f(x) = anxn + an−1xn−1 + ... + a1x + a0, where a0, a1,... an−1, an are real numbers, is O(xn).
1. assuming 2.= xn 3.<- 4.Hence
Order the following steps of a trace of the binary search algorithm used to search for 13 in the list 10, 11, 12, 13, 14.
1. compare 13 to 12 and set I to 4 2. compare 4 to 5 and set m to 4 3. compare 13 to 13 and set j to 4 4.compare 4 to 4. Then compare 13 to 13
What change is made by the cashier's algorithm for 66 cents using quarters, dimes, nickels, and pennies?
2 quarters, 1 dime, 1 nickel, and 1 penny
What is the list at the end of the first pass of the bubble sort algorithm when given the list 4, 2, 6, 7, 5 as input.
2, 4, 6, 5, 7
Which of the following is the sequence at the end of the second pass when the insertion sort algorithm is used to sort the list 4, 2, 6, 7, 5?
2, 4, 6, 7, 5
Use bubble sort to sort 4, 3, 5, 2, 6, showing the list obtained at each step.
After the first pass 3, 4, 2, 5, 6 After the second pass 3, 2, 4, 5, 6 After the third pass 2, 3, 4, 5, 6 After the fourth pass 2, 3, 4, 5, 6
Which of statements are true about worst-case and average-case complexity?
Average-case analysis provides an estimate of the average number of operations an algorithm uses with an input of size n. Worst-case estimate can never be smaller than an average-case estimate.
Problems for which a solution can be checked in polynomial time are said to belong to the class hBlank 1Blank 1 h , Incorrect Unavailable. Problems for which a solution can be found with an algorithm with polynomial time worst-case complexity are said to belong to the class jBlank 2Blank 2 j , Incorrect Unavailable.
Blank 1: NP Blank 2: P
Which pair of witnesses can be used to show that 10x is O(x2)?
C = 15 and k = 10 C = 1 and k = 10 C = 10 and k = 1
Which of the following are algorithmic paradigms?
Greedy algorithms Brute-force algorithms
Which of these statements are true? (Select all that apply.)
If f1(x) is O(g(x)) and f2(x) is O(g(x)) then, (f1 + f2)(x) is O(g(x)). If f1(x) is O(g(x)) and f2(x) is O(g(x)) then, (f1 f2)(x) is O(g(x)2). If f1(x) is O(g1(x)) and f2(x) is O(g2(x)) then, (f1 + f2)(x) is O(max(|g1(x)|, |g2(x)|)).
Match the terminology on the left with the definition on the right.
Intractable matches Choice A problem that cannot be solved using an algorithm with worst-case polynomial time. Tractable matches Choice A problem that can be solved using an algorithm with worst-case polynomial time complexity. Solvable matches Choice An algorithm exists for finding an answer to all instances of a problem. Unsolvable matches Choice There is no algorithm for finding answers to all instances of the problem.
Which of the following problems are known to be tractable.
Sorting a list Searching for an element in a list
Which of these is true?
The algorithm for matrix multiplication uses Θ(n3) operations. There are matrix multiplication algorithms that are faster than Θ(n3).
Which of these statements is true about the time complexity of a linear search?
The algorithm may require Ω(n) comparisons for some input of size n. The algorithm requires no more than O(n) comparisons for all input of size n elements.
Which of these statements are true about the bubble sort algorithm as specified in the text.
The bubble sort algorithm's first pass always makes the same number of comparisons for lists of the same size. For some input, the algorithm performs exactly one interchange. For some input, the algorithm does not perform any interchanges.
Which of these are true?
The most efficient comparison sorting algorithms can sort n items using Θ(n log n) comparisons. The worst-case complexity of insertion sort is Θ(n2) comparisons. The worst-case complexity of bubble sort is Θ(n2) comparisons.
Which of the following statements apply to a greedy algorithms?
They select the best choice at each step according to some criteria. A proof is required to show a particular greedy algorithm always produces an optimal solution. To show that a greedy algorithm does not always produce an optimal solution, a counterexample is sufficient. They solve optimization problems.
Using the greedy change-making algorithm, determine the minimum number of coins required to make change for 36 cents, using quarters, dimes, nickels, and pennies.
Three coins
Which of these considerations are important reasons for studying the computational complexity of algorithms?
We need to estimate the time required to solve a problem of a specific size. We want to know which of several possible algorithms to use. We want to know how much memory will be required.
Sort the elements in the list k, m, h, g, e, a, b, d, so that they are in increasing alphabetical order.
a, b, d, e, g, h, k, m
Which of the following are correct statements?
f(n) = 3n log(n!) + (n2 + 3) log n is O(n2 log n). f(n) = (n + 1) log(n2 + 1) + 3n2 is O(n2).
Which of these statements are true?
f(x) = 1 is O(x). f(x) = 17x2 is O(16x2). f(x) = 40x3 is O(x4).
Define f(x) = x2 + 2x. Select all of the functions g(x) below for which f(x) is Ω(g(x))?
g(x) = x3 g(x) = x log x g(x) = x2 g(x) = 2x
Match the functions in the left column with the smallest big-O estimate in the right column.
log n! matches Choice O(n log n) n! matches Choice O(nn) 1 + 2 + ⋅⋅⋅ + n matches Choice O(n2) log n matches Choice O(n)
Identify the true functions from the following. Multiple select question.
n8 is O(3n). (log2 n)7 is O(n8). n5 is O(n7).
Match functions of the same order.
x3 + x2 + 17 matches Choice 8x3 + 100x x2 + x2 log x matches Choice x2log (x3 + 1) 3x(x2 + 1) matches Choice (2x + 3x)(8x2 + x) x(log x)2 + 8(log x)3 matches Choice (x + 17)((log x)2 + log x) (x3 + x2)(2x + 3) matches Choice 2x(x3 + x(log x)2)
Let f and g be functions from the set of real numbers to the set of real numbers, then f(x) is O(g(x)) if there are constants C and k such that
|f(x)| ≤ C|g(x)| whenever x > k
Match the complexity on the left with the corresponding terminology on the right.
Θ(1) matches Choice Constant complexity Θ(log n) matches Choice Logarithmic complexity Θ(n) matches Choice Linear complexity Θ(n log n) matches Choice Linearithmic complexity Θ(nb) matches Choice Polynomial complexity Θ(bn) where b > 1 matches Choice Exponential complexity Θ(n!) matches Choice Factorial complexity
Give a big-Θ estimate for the number of arithmetic operations and comparisons used by the brute-force algorithm for finding the closest pair of n points in the plane.
Θ(n2)
Drag and drop the total number of multiplications against the corresponding ways of multiplying the matrices A, B, C, and D with dimensions 20 × 10, 10 × 30, 30 × 40, and 40 × 15 respectively.
((AB)C)D matches Choice 42,000 (A(BC))D matches Choice 32,000 A((BC)D) matches Choice 21,000 (AB)(CD) matches Choice 33,000 A(B(CD)) matches Choice 25,500
Which is the most efficient method to find the multiplication of the matrices A of order 3 × 2, Bof order 2 × 1, and C of order 1 × 5
(AB)C
Order the following steps to produce an average-case analysis of the linear search algorithm in terms of the average number of comparisons used. You can assume the integer x is in the list.
1. fi x is the /th term 2. the average number 3. this can then be 4. this can .. n+2 5. Hence, the av
Rank the following functions so that each function is big-O of the one above it, that is rank them in descending order.
1. n! 2.2n 3.n2 4.n log n 5. n 6. log n
Order the steps to sort a list with n elements, using insertion sort.
1. the insertion sort begins 2. inserts the 2nd element 3.The 3rd element is compared 4.if the third is larger 5.the procdure is cont
Arrange these steps in order to show that n3 is not O(n2)
1. to show 2.Then there are 3.but then it follows 4. This is a contradiction 5.Hence there can be no pair of witness 6. we conclude
Arrange these steps in order to show that n2 is O(n3).
1.1. to show that 2. to find that 3.hence, we can take 4. therefore,
Suppose that f1(x) is O(g1(x)) and that f2(x) is O(g2(x)). Order the steps of the proof showing that (f1 + f2)(x) is O(max(|g1(x)|,|g2(x)|)).
1.|(f1 2.<_|f1 3.<_ C1... for some cont 4. where g(x) 5. where c=c 6. hence... hence
The number of character comparisons used by the naive string matcher to look for the pattern is in the text Mississippi is .
13
Find the number of additions and multiplications of integers, required to multiply two 3 × 3 matrices with integer entries. Multiple choice question.
18 additions and 27 multiplications
Find the highest number of multiplications of integers that may be needed to multiply the matrices A, B, and C, where A is 20×10, B is 10×30, and C is 30×40, all with integer entries. This results from the least efficient ordering of operations.
20000
Using the greedy algorithm for scheduling talks, find the greatest number of talks that can be scheduled if the starting and ending times of the possible talks are 8:00-8:50, 8:30-9:00, 8:55-9:45, 9:15-9:55, 10:00-10:30, 10:15-10:25, 10:30-10:55, 11:00-11:35, 10:55-11:25, 10:45-11:30. Multiple choice question.
5
Given as input an integer x and the integers 1, 8, 17, 47, 2, 3, 41, match the input x on the left with the output of the linear search algorithm on the right.
5 matches Choice 0 1 matches Choice 1 3 matches Choice 6 17 matches Choice 3 41 matches Choice 7
An analysis of the number of operations required to solve a problem of a particular size involves the qQqBlank 1Blank 1 qQq , Incorrect Unavailable qQBlank 2Blank 2 qQ , Incorrect Unavailable of the algorithm. An analysis of the computer memory required involves the QBlank 3Blank 3 Q , Incorrect Unavailable QBlank 4Blank 4 Q , Incorrect Unavailable of the algorithm.
Blank 1: time Blank 2: complexity Blank 3: space Blank 4: complexity
A problem that is solvable using an algorithm with polynomial worst-case complexity is called . Problems that cannot be solved using an algorithm with worst-case polynomial time complexity are called . Problems for which it can be shown that no algorithm exists for solving them are called .
Blank 1: tractable Blank 2: intractable Blank 3: unsolvable
Which pairs of numbers C, k are witnesses to the fact that x2 + 3x is O(x2)?
C = 4, k = 1 C = 5, k = 1 C = 4, k = 2
Why do we measure time complexity in terms of the number of operations required instead of actual computer time? (Select all that apply.)
Different computers take different amounts of time to perform the same basic operations. There are many reasons why the same instance of an algorithm on different occasions may take different amounts of time to execute. Computer processing speeds have been increasing as time passes.
Which of these statements are true about the insertion sort algorithm as specified in the book.
For all sequences of the same size, the algorithm always uses the same number of passes. After inserting the jth element, the first j elements are in order. Linear search is used to insert the next element on each pass.
Which of these are true statements? Multiple select question.
It may be the case that for a particular sequence bubble sort is more efficient than insertion sort. The worst-case complexity of insertion sort and bubble sort are the same.
Match the algorithm on the left with its complexity on the right.
Linear search matches Choice Linear complexity binary search matches Choice logarithmic complexity merge sort matches Choice lineararithmic complexity finding the larger of the first two terms in a sequence matches Choice constant complexity brute-force satisfiability matches Choice exponential complexity brute-force traveling salesperson matches Choice factorial complexity insertion sort matches Choice quadratic complexity
Match the algorithm with a big-Θ estimate of its worst-case complexity.
Locating an item in an unordered list by examining the items one by one. matches Choice Θ(n) Locating an item in an ordered list by successively splitting the list in half and comparing the element to the middle element. matches Choice Θ(log n) Print out all the bit strings of length n matches Choice Θ(2n) Print out all ordered pairs of a set with n elements matches Choice Θ(n2)
Match the concept on the left with the definition on the right.
Time complexity matches Choice The number of operations required to solve a problem of a particular size Space complexity matches Choice The amount of computer memory required to solve a problem of a particular size Worst-case time complexity matches Choice The largest number of operations needed to solve a problem of a particular size Average-case time complexity matches Choice The average number of operations used to solve the problem over all possible inputs of a given size
Which of the statements below are true about the halting problem? Recall that the halting problem asks whether there can be a procedure that takes as input any computer program and any input to this program and determines whether when given this input the program will stop. (Select all that apply.)
You can determine that no such procedure exists using a proof by contradiction. Alan Turing was able to resolve the halting problem.
Identify the correct statements from the following.
f(n) = 2n2 + 8 log n is Θ(n2) f(n) = ∑ni=1i is Θ(n2)
Which of these inequalities correctly completes this definition? If f and g are functions from the set of integers or the set of real numbers to the set of real numbers, then f(x) is Ω(g(x)) if there are positive constants C and k such that _____ whenever x > k. Multiple choice question. |
|f(x)| ≥ C|g(x)|