Divide And Conquer
Everything on SkillVeris tagged Divide And Conquer — collected across the glossary, study notes, blog, and cheat sheets.
15 resources across 1 library
Interview Questions(15)
What is Recursion?
Recursion is a technique where a function solves a problem by calling itself on a smaller instance of the same problem, until it reaches a base case that stops…
Merge Sort vs Quick Sort: What is the Difference?
Merge sort splits an array in half, recursively sorts both halves, then merges them, guaranteeing O(n log n) time and stability at the cost of O(n) extra space…
What is Binary Search?
Binary search is an algorithm that finds a target value in a sorted collection by repeatedly halving the search range, comparing the target to the middle eleme…
What is the Divide and Conquer Strategy?
Divide and conquer is an algorithm design strategy that breaks a problem into smaller independent subproblems of the same type, solves each subproblem recursiv…
How Do You Find the Median of Two Sorted Arrays?
The median of two sorted arrays can be found in O(log(min(m, n))) time by binary searching a partition point on the smaller array, choosing a matching partitio…
How Do You Merge K Sorted Linked Lists?
K sorted linked lists are merged efficiently in O(N log k) time by using a min-heap of size k that always holds the current head of each list, repeatedly poppi…
How Do You Search in a Rotated Sorted Array?
Searching a rotated sorted array for a target in O(log n) works by running a modified binary search: at each step, determine which half (left or right of mid)…
How Do You Find a Peak Element in an Array?
A peak element — one strictly greater than both its neighbors, with -infinity assumed beyond the array's edges — can be found in O(log n) using binary search:…
What is Binary Search on the Answer?
Binary search on the answer is a technique where, instead of searching for a value inside a sorted array, you binary search over the range of possible ANSWERS…
What is Ternary Search?
Ternary search finds the extremum (minimum or maximum) of a strictly unimodal function by evaluating the function at two interior points that split the range i…
What is Exponential Search?
Exponential search finds a target in a sorted array by first doubling an index (1, 2, 4, 8, ...) until it finds a range that must contain the target, then runn…
Iterative vs Recursive Algorithms: What is the Difference?
An iterative algorithm repeats a loop body while updating variables directly, using O(1) call-stack space, while a recursive algorithm solves a problem by call…
What is the Master Theorem?
The Master Theorem gives a direct formula for the time complexity of divide-and-conquer recurrences of the form T(n) = a·T(n/b) + f(n), by comparing f(n) again…
What is a Recurrence Relation in Algorithm Analysis?
A recurrence relation expresses the running time of a recursive algorithm as a function of its running time on smaller inputs, such as T(n) = 2T(n/2) + O(n) fo…
What are Cache-Oblivious Algorithms?
A cache-oblivious algorithm is designed to use the memory hierarchy — CPU caches, RAM, and disk — efficiently without knowing any cache size or block size as a…