You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
Analysis
Create a new linked list link them together.
23. Merge k Sorted Lists
Description
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
Analysis
Use merge two sorted list function.
41. First Missing Positive
Description
Given an unsorted integer array, find the smallest missing positive integer.
Analysis
Use bucket sort.
75. Sort Colors
Description
Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.
Analysis
Set red and blue index and do swap during iteration.
88. Merge Sorted Array
Description
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
Analysis
Iterate from the end of nums1
147. Insertion Sort List
Description
Analysis
Linked list
148. Sort List
Description
Sort a linked list in O(n log n) time using constant space complexity.
Analysis
Find middle and split the list into two and sort and merge them.
164. Maximum Gap
Description
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
Return 0 if the array contains less than 2 elements.
Analysis
Use radix sort.
179. Largest Number
Description
Given a list of non negative integers, arrange them such that they form the largest number.
Analysis
Convert to string first then sort.
215. Kth Largest Element in an Array
Description
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.
Analysis
Use quicksort.
274. H-Index
Description
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.
Analysis
Use count sort.
The text was updated successfully, but these errors were encountered:
Sort
Quick Sort
Problems
21. Merge Two Sorted Lists
Description
Analysis
23. Merge k Sorted Lists
Description
Analysis
41. First Missing Positive
Description
Analysis
75. Sort Colors
Description
Analysis
88. Merge Sorted Array
Description
Analysis
147. Insertion Sort List
Description
Analysis
148. Sort List
Description
Analysis
164. Maximum Gap
Description
Analysis
179. Largest Number
Description
Analysis
215. Kth Largest Element in an Array
Description
Analysis
274. H-Index
Description
Analysis
The text was updated successfully, but these errors were encountered: