Algorithm Complexity Analysis
- 65Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
65 questions
- 1A search algorithm is used to find an item or group of items from a_____.
Hint
Think of the set of possible items being examined.
Answer
collection
- 2A collection that is represented through a range of possible values rather than stored items is called an_____collection.
Hint
Square-root approximation was an example involving possible values rather than a stored list.
Answer
implicit
- 3A collection containing explicitly stored data records, such as student records, is an_____collection.
Hint
The data items are directly present and can be examined one by one.
Answer
explicit
- 4Exhaustive enumeration, bisection search for square roots, and Newton-Raphson are examples of search over an_____collection.
Hint
These methods search among possible numerical values.
Answer
implicit
- 5Linear search examines list elements one at a time until it finds the target or reaches the_____of the list.
Hint
This is a sequential walk through every possible position.
Answer
end
- 6Linear search can operate on a list in_____order.
Hint
The method does not rely on elements being arranged from small to large.
Answer
arbitrary
- 7The worst-case complexity of linear search is_____in the length of the list.
Hint
In the worst case, every element must be examined.
Answer
linear
- 8In a sorted-list linear search, the algorithm can stop when the current element is_____than the target.
Hint
All later elements are even larger because the list is sorted.
Answer
bigger
- 9Although early stopping improves the average behavior of sorted-list linear search, its worst-case complexity remains_____.
Hint
A worst-case target may still require examining nearly the entire list.
Answer
order n
- 10Bisection search requires the list to be_____before it can repeatedly discard half of the remaining elements.
Hint
The algorithm uses relative ordering to decide which half may contain the target.
Answer
sorted
- 11At each step of bisection search, the algorithm examines the_____element of the remaining list.
Hint
It chooses the element halfway between the current boundaries.
Answer
midpoint
- 12If the target is larger than the midpoint element during bisection search, the algorithm continues with the_____half.
Hint
The target must be among the values greater than the midpoint.
Answer
upper
- 13If the target is smaller than the midpoint element during bisection search, the algorithm continues with the_____half.
Hint
The target must be among the values less than the midpoint.
Answer
lower
- 14Bisection search reduces the remaining problem by a factor of_____at each step.
Hint
One of two equal portions is discarded after each comparison.
Answer
two
- 15The number of bisection-search steps is logarithmic because the search ends when 1/2k of the original problem equals_____.
Hint
The process stops when only one candidate remains.
Answer
1
- 16Bisection search makes only one of its two possible recursive calls because it decides which_____contains the target.
Hint
The other half is discarded after comparing with the midpoint.
Answer
half
- 17The work performed inside each bisection-search step is constant because the algorithm passes_____rather than copying the list.
Hint
The implementation tracks boundaries into the original list.
Answer
pointers
- 18The resulting complexity of bisection search is_____in the length of the list.
Hint
The number of steps grows as a logarithm of the input size.
Answer
logarithmic
- 19For a single search, sorting first is worthwhile only if the cost of sorting plus logarithmic search is less than the cost of_____search.
Hint
Compare sorting followed by bisection with checking elements one by one.
Answer
linear
- 20Any sorting algorithm must take at least linear time because it must inspect each of the_____input elements.
Hint
The algorithm must determine where every element belongs.
Answer
n
- 21Sorting once and then performing many searches spreads or_____the cost of sorting across those searches.
Hint
The one-time expense is distributed over repeated operations.
Answer
amortizes
- 22For k bisection searches on a list of length n, the search portion costs order_____.
Hint
Multiply the logarithmic cost of one search by the number of searches.
Answer
k log n
- 23When the number of searches is sufficiently large, the one-time sorting cost can become_____compared with the repeated search cost.
Hint
Repeated searches dominate the total cost.
Answer
irrelevant
- 24The hierarchy discussed ranks constant, logarithmic, linear, log linear, quadratic, and exponential algorithms from more desirable to less desirable as growth becomes_____.
Hint
Algorithms with slower growth are preferred for large inputs.
Answer
faster
- 25An algorithm with order n log n complexity is described as a_____algorithm.
Hint
Its growth combines linear and logarithmic factors.
Answer
log linear
- 26The worst-case performance of a sorting algorithm is emphasized because a favorable average case does not guarantee good behavior in the_____case.
Hint
This case represents the greatest possible cost for the algorithm.
Answer
worst
- 27BOGO sort repeatedly generates permutations until it finds one that is_____.
Hint
The algorithm stops when the randomly arranged elements are in the desired order.
Answer
sorted
- 28BOGO sort is also known as monkey sort, stupid sort, slow sort, permutation sort, and_____sort.
Hint
This name suggests randomly trying arrangements until one works.
Answer
shotgun
- 29Because BOGO sort can examine all possible arrangements, its average complexity is_____.
Hint
The number of permutations of n elements is n!.
Answer
n factorial
- 30The best-case complexity of BOGO sort is order_____because the list may already be sorted.
Hint
Even in the best case, the algorithm must verify the ordering.
Answer
n
- 31Bubble sort compares neighboring elements in pairs and swaps them when the earlier element is_____.
Hint
The larger value is moved toward the end of the list.
Answer
bigger
- 32Bubble sort continues making passes until it completes one full pass with no_____.
Hint
No exchanges means that no adjacent pair is out of order.
Answer
swaps
- 33After each complete pass of bubble sort, the largest unsorted element is placed at the_____of the list.
Hint
Repeated swaps move the larger element rightward.
Answer
end
- 34Bubble sort performs at most order n passes, with each pass doing order n work, giving quadratic complexity of order_____.
Hint
Multiplying two linear factors produces a quadratic factor.
Answer
n squared
- 35In bubble sort, the flag tracking whether a swap occurred is initially set to_____before each pass.
Hint
The algorithm must enter the loop at least once.
Answer
true
- 36Selection sort repeatedly finds the_____remaining element and places it at the next position in the sorted prefix.
Hint
The algorithm builds the sorted portion from left to right.
Answer
smallest
- 37After i steps of selection sort, the first i elements form a sorted_____.
Hint
A prefix is the beginning portion of a sequence.
Answer
prefix
- 38After each selection-sort step, every element in the unsorted suffix is at least as large as every element in the sorted_____.
Hint
The sorted portion contains the smallest elements found so far.
Answer
prefix
- 39The loop invariant for selection sort states that the sorted prefix is ordered and no element in it is larger than the smallest element in the_____.
Hint
The suffix is the remaining unsorted part of the list.
Answer
suffix
- 40The base case for the selection-sort loop invariant is an empty_____.
Hint
Before any elements have been selected, the sorted portion contains nothing.
Answer
prefix
- 41The selection-sort loop invariant is established for all steps by using_____.
Hint
Prove the base case and then show that one valid step preserves the property.
Answer
induction
- 42Selection sort has quadratic complexity because it performs order n passes and compares elements in the remaining list during each_____.
Hint
The amount of remaining work decreases, but the total still has quadratic growth.
Answer
pass
- 43Merge sort uses the divide-and-conquer strategy by splitting a problem into smaller versions of the same problem and then_____their results.
Hint
The solutions to the smaller subproblems are brought back together.
Answer
combining
- 44A list containing zero or one element is already_____and serves as the base case for merge sort.
Hint
No pair of elements can be out of order in such a list.
Answer
sorted
- 45When a list has more than one element, merge sort divides it into_____sublists.
Hint
The list is split approximately in half.
Answer
two
- 46To merge two sorted lists, compare their_____remaining elements and append the smaller one to the result.
Hint
The smallest unprocessed element must be at the front of each sorted sublist.
Answer
first
- 47When one sorted sublist becomes empty during a merge, the remainder of the other list can be copied directly to the_____of the result.
Hint
The remaining elements are already in increasing order.
Answer
end
- 48The merge operation examines each element of the two sublists at most once for copying, making its complexity_____in the total list length.
Hint
The work is proportional to the combined number of elements.
Answer
linear
- 49In a merge, the maximum number of element comparisons is bounded by the number of elements in the_____sublist.
Hint
Once one list is empty, the merge stops comparing.
Answer
longer
- 50Merge sort keeps dividing until each sublist has zero or_____elements.
Hint
A sublist of this size is automatically sorted.
Answer
one
- 51At each level of merge sort, the total number of elements processed remains order_____even though the number of sublists changes.
Hint
All sublists together still contain the original elements.
Answer
n
- 52The number of levels in merge sort is logarithmic because the problem size is repeatedly divided by_____.
Hint
Each division creates two approximately equal subproblems.
Answer
two
- 53Because merge sort performs order n work across order logn levels, its complexity is order_____.
Hint
Multiply the linear work per level by the logarithmic number of levels.
Answer
n log n
- 54The lecture presents merge sort as the best known_____-case sorting performance discussed.
Hint
The claim concerns guaranteed performance rather than average behavior.
Answer
worst
- 55Data structures such as tuples, lists, dictionaries, and more complicated structures provide ways to_____knowledge.
Hint
They organize information so a program can work with it.
Answer
represent
- 56Iteration and loops are described as computational_____for approaching problems.
Hint
They are ways of thinking about repeated computation.
Answer
metaphors
- 57Recursion breaks a problem into simpler versions of the_____problem.
Hint
A recursive subproblem has the same structure as the original.
Answer
same
- 58Abstraction captures a computation in a procedure while hiding its internal_____.
Hint
Users of the procedure need only know what it promises to do.
Answer
details
- 59Classes and methods help modularize systems by combining data with the operations that act on_____.
Hint
The operations belong with the data they manipulate.
Answer
them
- 60The three A's of computational thinking are abstraction, automation, and_____.
Hint
The final A concerns step-by-step procedures for solving problems.
Answer
algorithms
- 61Automation means mechanizing an abstraction into a sequence of_____that a machine can execute.
Hint
A program specifies actions in an ordered process.
Answer
steps
- 62Thinking clearly about how to describe an algorithm helps_____or clarify one's thinking about a problem.
Hint
A precise description makes an idea more definite and easier to inspect.
Answer
crystallize
- 63Divide and conquer, recursion, abstraction, and algorithmic complexity are examples of computational modes of_____.
Hint
They are mental approaches for analyzing and solving problems.
Answer
thinking
- 64Computational thinking asks how to take a problem from biology, chemistry, mathematics, or another field and design an_____to simulate or evaluate it.
Hint
The desired solution is a precise sequence of computational steps.
Answer
algorithm
- 65The lecture suggests that some problems are inherently more difficult than others because they belong to different complexity_____.
Hint
Constant, linear, quadratic, and exponential are examples of these categories.
Answer
classes

Ask anything
We've read this whole study set, so questions about it get the best answers.