Exam 3: Algorithms
Exam 1: The Foundations: Logic and Proofs200 Questions
Exam 2: Basic Structures: Sets, Functions, Sequences, Sums, Matrices214 Questions
Exam 3: Algorithms52 Questions
Exam 4: Number Theory and Cryptography154 Questions
Exam 5: Induction and Recursion53 Questions
Exam 6: Counting156 Questions
Exam 7: Discrete Probability53 Questions
Exam 8: Advanced Counting Techniques128 Questions
Exam 9: Relations74 Questions
Exam 10: Graphs127 Questions
Exam 11: Trees97 Questions
Exam 12: Boolean Algebra77 Questions
Exam 13: Modeling Computation71 Questions
Select questions type
Describe an algorithm that takes a list of n integers (n ≥ 1) and finds the average of the largest and smallest integers in the list.
Free
(Essay)
4.9/5
(40)
Correct Answer:
procedure
for
if
if
return
In questions find the "best" big-O notation to describe the complexity of the algorithm. Choose your
answers from the following:
1,
-An algorithm that lists all ways to put the numbers 1, 2, 3, . . . , n in a row.
Free
(Short Answer)
4.9/5
(50)
Correct Answer:
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: t:=0 for i=1 to n for j=1 to n t:=(it+jt+1
Free
(Short Answer)
4.8/5
(34)
Correct Answer:
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: t:=1 for i=n to t:=t+2it
(Short Answer)
4.9/5
(42)
Prove or disprove that the greedy 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.9/5
(34)
Arrange the functions and in a list so that each function is big- of the next function .
(Short Answer)
4.9/5
(37)
Prove or disprove that the greedy algorithm for making change always uses the fewest coins possible when the
denominations available are pennies (1-cent coins), nickels (5-cent coins), and quarters (25-cent coins).
(True/False)
4.9/5
(33)
assume that the number of multiplications of entries used to multiply a p × q and a q × r matrix is
pqr.
-Whatand 7 ×is 3,therespbestectivorderely?to form the product ABC if A, B and C are matrices with dimensions 2 × 5, 5 × 7
(Short Answer)
4.9/5
(32)
assume that the number of multiplications of entries used to multiply a p × q and a q × r matrix is
pqr.
-Whatand 6 ×is 12,therespbestectivorderely?to form the product ABC if A, B and C are matrices with dimensions 8 × 3, 3 × 6
(Short Answer)
4.9/5
(31)
In questions find the "best" big-O notation to describe the complexity of the algorithm. Choose your
answers from the following:
1,
-The number of print statements in the following: i:=1,j:=1 while i\leqn while j\leqi print "hello"; j:=j+1 i:=i+1
(Short Answer)
4.8/5
(31)
Describe an algorithm that takes a list of n integers (n ≥ 1) and finds the location of the last even integer in the list. and returns 0 if there aer no even integers in the list .
(Essay)
4.8/5
(28)
In questions find the "best" big-O notation to describe the complexity of the algorithm. Choose your
answers from the following:
1,
-
(Short Answer)
4.9/5
(44)
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.9/5
(33)
Describe an algorithm that takes a list of integers a1, a2, . . . , an (n ≥ 2) and finds the second-largest integer in the sequence by going through the list and keeping track of the largest and second-largest integer encountered.
(Essay)
4.8/5
(30)
In questions find the "best" big-O notation to describe the complexity of the algorithm. Choose your
answers from the following:
1,
-A linear search to find the smallest number in a list of n numbers.
(Short Answer)
4.9/5
(33)
In questions find the best big-O function for the function. Choose your answer from among the following:
1,
-
(Short Answer)
4.7/5
(35)
Showing 1 - 20 of 52
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)