Algorithm Design and Analysis Flashcards
6 cards from real B CompE Bachelor of Computer Engineering practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 Algorithm Design and Analysis flashcards as text
What is the recurrence relation for merge sort, and what does the Master Theorem give as its solution?
Answer: T(n) = 2T(n/2) + O(n) → O(n log n)
Merge sort divides into 2 halves (2T(n/2)) and merges in O(n) time; by the Master Theorem case 2, this solves to O(n log n).
In which problem class does P reside in the P vs NP question?
Answer: Problems solvable in polynomial time
P is the class of decision problems that can be solved by a deterministic algorithm in polynomial time, representing 'tractable' or efficiently solvable problems.
What is memoization in the context of dynamic programming?
Answer: Caching the results of subproblems in a table to avoid recomputation
Memoization is a top-down DP technique where computed subproblem results are stored (usually in a hash map or array) so they can be retrieved instantly if needed again.
What is the key property of a greedy algorithm?
Answer: It makes the locally optimal choice at each step without reconsidering past decisions
A greedy algorithm makes the best choice available at each step and never revisits or undoes those choices, hoping the locally optimal selections lead to a global optimum.
Which algorithm is used to find the Minimum Spanning Tree of a graph using a priority queue?
Answer: Prim's Algorithm
Prim's algorithm builds a Minimum Spanning Tree by greedily adding the minimum-weight edge connecting the current tree to an unvisited vertex, using a priority queue.
What is the worst-case time complexity of Quick Sort?
Answer: O(n²)
Quick Sort degrades to O(n²) in the worst case when the pivot is always the smallest or largest element, causing maximally unbalanced partitions.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy