1What is the first main step in the divide-and-conquer method?
General method
Easy
A.Combine all inputs into one value
B.Search the input in sequential order
C.Remove every repeated input value
D.Divide the problem into smaller subproblems
Correct Answer: Divide the problem into smaller subproblems
Explanation:
Divide and conquer begins by dividing a problem into smaller subproblems of the same general type.
Incorrect! Try again.
2Which three steps typically form a divide-and-conquer algorithm?
General method
Easy
A.Initialize, iterate, and stop
B.Divide, conquer, and combine
C.Search, swap, and insert
D.Compare, delete, and append
Correct Answer: Divide, conquer, and combine
Explanation:
The method divides the problem, solves the smaller subproblems, and combines their solutions.
Incorrect! Try again.
3What is a base case in a recursive divide-and-conquer algorithm?
General method
Easy
A.A case containing invalid input
B.A small case solved directly
C.A case divided without stopping
D.A case requiring extra storage
Correct Answer: A small case solved directly
Explanation:
A base case is simple enough to solve directly, so no further recursive division is needed.
Incorrect! Try again.
4In divide and conquer, what does the combine step do?
General method
Easy
A.Selects a random element from the input
B.Divides each subproblem into equal pieces
C.Checks whether the input is already sorted
D.Builds the final solution from subproblem results
Correct Answer: Builds the final solution from subproblem results
Explanation:
The combine step joins the solutions of smaller subproblems to produce the solution to the original problem.
Incorrect! Try again.
5What condition must normally be satisfied before binary search is applied to an array?
Binary search
Easy
A.The array must be reversed
B.The array must contain duplicates
C.The array must be sorted
D.The array must have even length
Correct Answer: The array must be sorted
Explanation:
Binary search relies on sorted order to decide which half may contain the target.
Incorrect! Try again.
6Which element does binary search examine first?
Binary search
Easy
A.The middle element
B.The final element
C.The first element
D.A random element
Correct Answer: The middle element
Explanation:
Binary search first compares the target with the middle element of the current search range.
Incorrect! Try again.
7What is the worst-case time complexity of binary search on a sorted array of elements?
Binary search
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
Each comparison reduces the remaining search range by approximately half, giving time.
Incorrect! Try again.
8If the target is smaller than the middle element in an ascending sorted array, where does binary search continue?
Binary search
Easy
A.Across the full array
B.At the final element
C.In the right half
D.In the left half
Correct Answer: In the left half
Explanation:
In ascending order, values smaller than the middle element can only occur in the left half.
Incorrect! Try again.
9How does merge sort divide an array?
Merge sort
Easy
A.Into positive and negative values
B.Into two smaller halves
C.Into groups of three elements
D.Into sorted and unsorted regions
Correct Answer: Into two smaller halves
Explanation:
Merge sort repeatedly divides the array into two smaller halves until the base cases are reached.
Incorrect! Try again.
10What happens during the merge step of merge sort?
Merge sort
Easy
A.The largest value is discarded
B.Adjacent values are always swapped
C.Two sorted sequences are combined
D.One pivot is placed correctly
Correct Answer: Two sorted sequences are combined
Explanation:
The merge step combines two sorted sequences into one sorted sequence.
Incorrect! Try again.
11What is the worst-case time complexity of merge sort?
Merge sort
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
Merge sort has logarithmically many division levels, and merging at each level takes time.
Incorrect! Try again.
12When does the recursive division in merge sort normally stop?
Merge sort
Easy
A.When every element has been compared once
B.When a subarray has exactly two duplicates
C.When a subarray has at most one element
D.When the largest element becomes the first
Correct Answer: When a subarray has at most one element
Explanation:
A subarray containing zero or one element is already sorted and forms a base case.
Incorrect! Try again.
13Which special element is selected during quick sort?
Quick sort
Easy
A.A counter
B.A sentinel
C.A pivot
D.A successor
Correct Answer: A pivot
Explanation:
Quick sort selects a pivot and uses it to partition the other elements.
Incorrect! Try again.
14What is the purpose of partitioning in quick sort?
Quick sort
Easy
A.To arrange elements around a pivot
B.To merge two sorted subarrays
C.To copy elements into a matrix
D.To locate a target by halving
Correct Answer: To arrange elements around a pivot
Explanation:
Partitioning places smaller and larger elements on appropriate sides of the pivot.
Incorrect! Try again.
15What is the average-case time complexity of quick sort?
Quick sort
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
With reasonably balanced partitions, quick sort runs in time on average.
Incorrect! Try again.
16What is the worst-case time complexity of quick sort?
Quick sort
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
Quick sort takes time when its partitions are repeatedly very unbalanced.
Incorrect! Try again.
17Why may standard fixed-size data types be unsuitable for very large integers?
Arithmetic with large integers
Easy
A.Their numeric range is limited
B.Their operations require sorting
C.Their values are always negative
D.Their digits cannot be compared
Correct Answer: Their numeric range is limited
Explanation:
A fixed-size type can represent only a limited range, so an integer with too many digits may overflow.
Incorrect! Try again.
18In divide-and-conquer multiplication, how are large integers commonly divided?
Arithmetic with large integers
Easy
A.Into odd and even numeric values
B.Into positive and negative terms
C.Into high and low digit parts
D.Into prime and composite factors
Correct Answer: Into high and low digit parts
Explanation:
Each large integer is commonly split into a high-order part and a low-order part.
Incorrect! Try again.
19Which algorithm is known for multiplying large integers using divide and conquer?
Arithmetic with large integers
Easy
A.Dijkstra algorithm
B.Kruskal algorithm
C.Karatsuba algorithm
D.Prim algorithm
Correct Answer: Karatsuba algorithm
Explanation:
The Karatsuba algorithm uses divide and conquer to multiply large integers efficiently.
Incorrect! Try again.
20How many recursive multiplications does the basic Karatsuba method use for each split?
Arithmetic with large integers
Easy
A.Two multiplications
B.Five multiplications
C.Three multiplications
D.Four multiplications
Correct Answer: Three multiplications
Explanation:
Karatsuba reduces the usual four products of two split numbers to three recursive multiplications.
Incorrect! Try again.
21A divide-and-conquer algorithm divides a problem of size into two subproblems of size and uses time to combine their solutions. What is its time complexity?
General method
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The recurrence is . Each recursion level costs , and there are levels.
Incorrect! Try again.
22What is the asymptotic solution of the recurrence ?
General method
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
By the Master Theorem, grows faster than the nonrecursive term , so it determines the result.
Incorrect! Try again.
23Which problem characteristic most directly supports an efficient divide-and-conquer solution?
General method
Medium
A.The problem splits into smaller solvable subproblems
B.The input must already be sorted
C.The solution must use constant memory
D.The problem must have only one base case
Correct Answer: The problem splits into smaller solvable subproblems
Explanation:
Divide and conquer is effective when a problem can be divided into smaller instances, solved recursively, and combined efficiently.
Incorrect! Try again.
24An algorithm solves one subproblem of size and performs additional work. What is the solution of ?
General method
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The work forms the geometric sum , whose total is .
Incorrect! Try again.
25In the worst case, how many element comparisons are needed for a successful binary search in a sorted array of distinct elements?
Binary search
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
A balanced search over elements has five levels, so a successful search requires at most five comparisons.
Incorrect! Try again.
26Which recurrence best represents the running time of binary search?
Binary search
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Binary search examines one half of the input after a constant-time comparison, giving logarithmic running time.
Incorrect! Try again.
27To find the first occurrence of a target in a sorted array containing duplicates, what should binary search do when it finds the target at index ?
Binary search
Medium
A.Return immediately
B.Continue searching the right half
C.Record and search the left half
D.Remove the element and restart
Correct Answer: Record and search the left half
Explanation:
The current match is a candidate, but an earlier occurrence may exist to its left.
Incorrect! Try again.
28A Boolean predicate is false up to some index and true afterward. Using a half-open interval , which update correctly finds the first true index?
Binary search
Medium
A.If true, set ; otherwise set
B.If true, set ; otherwise set
C.If true, set ; otherwise set
D.If true, return immediately; otherwise set
Correct Answer: If true, set ; otherwise set
Explanation:
A true midpoint may be the first true index, so it remains in the interval; a false midpoint and all earlier indices can be discarded.
Incorrect! Try again.
29Which recurrence describes standard merge sort on an array of size ?
Merge sort
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Merge sort recursively sorts two halves and then merges them in linear time.
Incorrect! Try again.
30During merging, which rule preserves the stability of merge sort when the front elements of the two halves have equal keys?
Merge sort
Medium
A.Choose the element from the left half
B.Choose the element from the right half
C.Swap both elements before choosing
D.Choose either element at random
Correct Answer: Choose the element from the left half
Explanation:
Choosing the left element first preserves the original relative order of equal-key elements.
Incorrect! Try again.
31While counting inversions during a merge, the next element from the right half is smaller than the next element from the left half. How many inversions should be added?
Merge sort
Medium
A.The number already merged
B.One inversion only
C.The size of the right half
D.The number remaining in the left half
Correct Answer: The number remaining in the left half
Explanation:
Because both halves are sorted, the selected right element is smaller than every unmerged element in the left half.
Incorrect! Try again.
32A bottom-up merge sort begins with eight sorted runs of length . How many complete merge passes are required to obtain one sorted run?
Merge sort
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The run lengths double as , requiring three merge passes.
Incorrect! Try again.
33Lomuto partitioning is applied to using the last element as pivot and the comparison . What array results after partitioning?
Quick sort
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The values , , and are moved before pivot , while remains after it.
Incorrect! Try again.
34A naive quick sort uses Lomuto partitioning with the last element as pivot and treats values equal to the pivot as smaller. What is its running time on an array whose elements are all equal?
Quick sort
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Each partition places the pivot at one end, producing subproblems of sizes and .
Incorrect! Try again.
35Suppose every quick-sort pivot divides the input into subarrays of sizes approximately and . What is the overall running time?
Quick sort
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The partitions remain proportionally balanced, giving logarithmic recursion depth with partition work per level.
Incorrect! Try again.
36If quick sort selects its pivot uniformly at random from distinct elements, what is the probability that the pivot is either the smallest or the largest element?
Quick sort
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Exactly two of the possible pivots are extreme elements, so the probability is .
Incorrect! Try again.
37Let and , where is a power of the number base. Which expression correctly represents ?
Arithmetic with large integers
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Expanding gives .
Incorrect! Try again.
38How does Karatsuba multiplication reduce the number of recursive half-size multiplications compared with the basic divide-and-conquer method?
Arithmetic with large integers
Medium
A.It uses two products and two divisions
B.It uses four products and no additions
C.It uses one product and repeated shifts
D.It uses three products and extra additions
Correct Answer: It uses three products and extra additions
Explanation:
Karatsuba computes , , and , deriving the middle term through additions and subtractions.
Incorrect! Try again.
39What is the asymptotic running time of Karatsuba multiplication according to ?
Arithmetic with large integers
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The Master Theorem gives , approximately .
Incorrect! Try again.
40Ignoring lower-order addition costs, what happens to the recursive multiplication work when the operand length is doubled in schoolbook divide-and-conquer multiplication and in Karatsuba multiplication?
Arithmetic with large integers
Medium
A.It grows by factors and , respectively
B.It grows by factors and , respectively
C.It grows by factors and , respectively
D.It grows by factors and , respectively
Correct Answer: It grows by factors and , respectively
Explanation:
Schoolbook splitting makes four half-size products, while Karatsuba makes three, so doubling the size scales their recursive work by and .
Incorrect! Try again.
41Consider the recurrence with constant work at the base case. What is its asymptotic solution?
General method
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
The subproblem fractions satisfy a characteristic exponent below , while the additive term is linear. By the Akra–Bazzi theorem, the linear combine cost dominates, giving .
Incorrect! Try again.
42For powers of two, suppose and . Which bound is tight?
General method
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
At recursion level , the nonrecursive work is proportional to . Summing these costs produces times a harmonic sum, yielding .
Incorrect! Try again.
43A divide-and-conquer algorithm satisfies , ignoring rounding. Which asymptotic running time follows?
General method
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Although the recursion tree is unbalanced, the subproblem sizes at each expansion sum to . The tree has logarithmic effective depth, so linear work across its levels totals .
Incorrect! Try again.
44A parallel divide-and-conquer algorithm creates subproblems of size , performs combine work, and has . Subproblems execute concurrently, but the combine operation is sequential. What is the asymptotic parallelism ?
General method
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
The work is at the balanced recurrence boundary. The span follows only one recursive branch and is , so their ratio is .
Incorrect! Try again.
45A lower-bound search uses the half-open interval and updates when , otherwise setting . Which invariant is sufficient to establish correctness?
Binary search
Hard
A.Every index at or below stores a value , and every index above stores a value .
B.Every index below stores a value , and every index at or above stores a value .
C.Every index below stores a value , and every index at or above stores a value .
D.Every index below stores a value , and every index at or above stores a value .
Correct Answer: Every index below stores a value , and every index at or above stores a value .
Explanation:
The updates preserve these two excluded regions. At termination , so that index is exactly the first position whose value is at least .
Incorrect! Try again.
46A sorted array is rotated at an unknown pivot and may contain arbitrarily many duplicate values. What is the tight worst-case complexity of determining whether a target occurs using comparison-based search?
Binary search
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Duplicates can make the first, middle, and last values equal, revealing no reliably sorted half. An adversarial array can therefore force examination of linearly many elements.
Incorrect! Try again.
47Exponential search examines indices until it brackets a present target whose first occurrence is at index , and then performs binary search. What is the tight comparison bound?
Binary search
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Doubling takes comparisons and produces a bracket of size . Binary search within that bracket has the same asymptotic cost.
Incorrect! Try again.
48A lower-bound algorithm must distinguish all possible insertion positions using binary predicates of the form . What is the minimum possible worst-case number of predicate evaluations?
Binary search
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
A binary decision tree of height has at most leaves. Representing insertion positions requires , and balanced binary search attains this bound.
Incorrect! Try again.
49For , what is the exact maximum number of element-to-element comparisons performed by standard top-down merge sort?
Merge sort
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Merging lists of total length requires at most comparisons. Summing this maximum over all merge levels gives .
Incorrect! Try again.
50While merging sorted halves and to count strict inversions satisfying and , which rule handles duplicate values correctly?
Merge sort
Hard
A.Take from when ; otherwise add the number of unmerged elements in .
B.Take from when ; otherwise add the number of unmerged elements in .
C.Take from when ; otherwise add the number of unmerged elements in .
D.Take from when ; otherwise add the number of unmerged elements in .
Correct Answer: Take from when ; otherwise add the number of unmerged elements in .
Explanation:
Equal values are not strict inversions, so the left value must be selected on equality without increasing the count. If , every remaining left value forms an inversion with .
Incorrect! Try again.
51A merge-sort variant always splits an input into fractions and , where , and merging costs . Ignoring rounding, what is the leading term of its comparison recurrence?
Merge sort
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
For , substitution gives a leading coefficient inversely proportional to the binary entropy .
Incorrect! Try again.
52An array consists of already identified nondecreasing runs. If a balanced merge schedule combines these runs, what is the tight worst-case merge cost, including the case ?
Merge sort
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Each element participates in at most balanced merge levels. Writing the bound as also captures the linear handling cost when only one run exists.
Incorrect! Try again.
53For randomized quicksort on distinct keys, where each pivot is chosen uniformly from the current subarray, what is the exact expected number of key comparisons?
Quick sort
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
A pair of ranks is compared exactly when one of them is the first pivot selected from the interval between them. Summing those pairwise probabilities yields .
Incorrect! Try again.
54Quicksort is modified to recurse only on the smaller partition and process the larger partition by iteration. What are its worst-case running time and auxiliary call-stack space?
Quick sort
Hard
A. time and stack
B. time and stack
C. time and stack
D. time and stack
Correct Answer: time and stack
Explanation:
Iteration does not prevent consistently poor partitions, so the time can remain quadratic. The recursively processed smaller side is at most half the current size, bounding stack depth by .
Incorrect! Try again.
55Three-way quicksort partitions elements into regions smaller than, equal to, and greater than the pivot, and does not recurse on the equal region. On an array of identical keys, what behavior results?
Quick sort
Hard
A. time and recursion depth
B. time and recursion depth
C. time and recursion depth
D. time and recursion depth
Correct Answer: time and recursion depth
Explanation:
A single partition scan places every key in the equal region. Both recursive outer regions are empty, so no nontrivial recursive chain remains.
Incorrect! Try again.
56For randomized quicksort on distinct keys, what is the probability that every nontrivial recursive call chooses an extreme key and therefore produces a maximally unbalanced partition?
Quick sort
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
At subproblem size , an extreme pivot is chosen with probability . Multiplying from through gives .
Incorrect! Try again.
57Karatsuba multiplication replaces four half-size products with three half-size products. Assuming linear-time additions, which recurrence and complexity describe multiplication of two -digit integers?
Arithmetic with large integers
Hard
A. and
B. and
C. and
D. and
Correct Answer: and
Explanation:
Karatsuba computes the low, high, and combined cross products recursively. The Master theorem gives exponent , approximately .
Incorrect! Try again.
58A three-way large-integer multiplication scheme evaluates enough points to use five recursive multiplications on inputs of size , with evaluation and interpolation work. What is its asymptotic complexity?
Arithmetic with large integers
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
The recurrence is . Since , recursive multiplication dominates the linear overhead.
Incorrect! Try again.
59A divide-and-conquer integer multiplication algorithm computes all four products of the high and low halves recursively. Even if its additions are optimized to linear time, what tight bound follows?
Arithmetic with large integers
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
The recurrence remains . Its recursive term has exponent , so improving additions alone does not beat quadratic time.
Incorrect! Try again.
60For a power of two, suppose a Karatsuba-style implementation satisfies and . Which expression solves the recurrence exactly?
Arithmetic with large integers
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
At level , the additive work is . Summing the geometric series and adding leaves gives .
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill.
The rest comes out of a student's own pocket: the domain, the storage,
and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →