排序
Data Structures & Algorithms · 8 notes
- Merge Two Sorted Arrayshistorical
Merge two sorted integer arrays A and B into A while preserving order. Assume A has enough space for all elements.
- Find the K-th Largesthistorical
Given an integer array, use the idea of quicksort to find the K-th largest number in the array.
- Queue Reconstruction by Heighthistorical
Each person is described by their height and the number of people at least as tall ahead of them. Reconstruct the queue from these shuffled descriptions.
- Largest Numberhistorical
Given a group of non-negative integers nums, rearrange the order of each number (each number cannot be split) so that they form the largest integer.
- Sort Colorshistorical
Given an array with n elements colored red, white, and blue, sort them in place so that elements of the same color are adjacent, in the order red, white, and blue.
- Median of Two Sorted Arrayshistorical
Given two sorted arrays of lengths m and n, find the median of their combined values.
- Shortest Unsorted Continuous Subarrayhistorical
Given an integer array nums, find a continuous subarray such that sorting only this subarray in ascending order makes the whole array sorted in ascending order.