LeetCode 912: Sort an Array
A clear explanation of sorting an array without built-in sorting using merge sort.
26 notes
A clear explanation of sorting an array without built-in sorting using merge sort.
A clear explanation of reconstructing a binary tree from preorder and postorder traversals using recursion and index ranges.
A clear explanation of solving Beautiful Array using divide and conquer with odd and even transformations.
A clear explanation of making a special binary string lexicographically largest using recursive decomposition and sorting.
A clear explanation of constructing a maximum binary tree recursively using divide and conquer.
A clear explanation of generating all possible results from different parenthesizations using divide and conquer recursion.
A clear explanation of counting pairs where nums[i] is greater than twice nums[j] using merge sort.
Build a quad tree from a binary square grid using recursive divide and conquer.
A clear explanation of finding the longest substring where every character appears at least k times using divide and conquer.
A clear explanation of Count of Range Sum using prefix sums and merge sort counting.
A clear explanation of finding the kth largest element using sorting, a min-heap, and Quickselect.
A clear explanation of finding the element that appears more than half the time using Boyer-Moore voting.
Sort a singly linked list in ascending order using merge sort with fast and slow pointers.
A clear explanation of converting a sorted linked list into a height-balanced binary search tree using slow and fast pointers.
A clear explanation of building a height-balanced binary search tree from a sorted array using divide and conquer.
A clear explanation of rebuilding a binary tree from inorder and postorder traversals using recursion and an index map.
A detailed explanation of merging k sorted linked lists using a min heap.
Divide-and-conquer sorts: merge sort variants, quicksort family, heapsort, and comparison-based sorting networks.
Divide and conquer sorting algorithm that partitions the array around a pivot and recursively sorts both sides.
Recursive merge sort that splits the array from the top and merges sorted halves.
Divide and conquer sorting algorithm that splits the array, sorts recursively, and merges in linear time.
Search a matrix sorted by rows and columns using divide and conquer.
Find a peak element in a 2D grid using divide and conquer.
Partition around a pivot so smaller elements go left and larger go right, then recursively sort each partition in expected O(n log n) time.
Divide the input into halves, recursively sort each half, then merge them — combining local order into global order in O(n log n) time.
Divide and conquer solves a problem by splitting it into smaller subproblems, solving those subproblems, and combining their answers.