Sorting Algorithms are methods of reorganizing a large number of items into some specific order such as highest to lowest, or vice-versa, or even in some alphabetical order.
These algorithms take an input list, processes it (i.e, performs some operations on it) and produce the sorted list.
The most common example we experience every day is sorting clothes or other items on an e-commerce website either by lowest-price to highest, or list by popularity, or some other order.
Algorithm | Best | Average | Worst |
---|---|---|---|
Quick Sort | Ω(n log(n)) | Θ(n log(n)) | O(n^2) |
Bubble Sort | Ω(n) | Θ(n^2) | O(n^2) |
Merge Sort | Ω(n log(n)) | Θ(n log(n)) | O(n log(n)) |
Insertion Sort | Ω(n) | Θ(n^2) | O(n^2) |
Selection Sort | Ω(n^2) | Θ(n^2) | O(n^2) |
Heap Sort | Ω(n log(n)) | Θ(n log(n)) | O(n log(n)) |
Radix Sort | Ω(nk) | Θ(nk) | O(nk) |
Bucket Sort | Ω(n+k) | Θ(n+k) | O(n^2) |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Pick from both sides! | 100 |
|
56:36 | |
Min Steps in Infinite Grid | 150 |
|
37:51 | |
Minimum Lights to Activate | 200 |
|
75:28 | |
Maximum Sum Triplet | 200 |
|
82:43 | |
Max Sum Contiguous Subarray | 225 |
|
33:39 | |
Add One To Number | 225 |
|
43:43 | |
Maximum Absolute Difference | 250 |
|
65:51 | |
Partitions | 300 |
|
75:26 | |
Maximum Area of Triangle! | 350 |
|
61:48 | |
Flip | 400 |
|
78:22 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Max Min | 150 |
|
17:31 | |
Merge Intervals | 225 |
|
78:57 | |
Merge Overlapping Intervals | 225 |
|
48:24 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Perfect Peak of Array | 200 |
|
49:19 | |
Move Zeroes | 200 |
|
29:37 | |
Make equal elements Array | 200 |
|
37:05 | |
Segregate 0s and 1s in an array | 200 |
|
16:37 | |
Array Sum | 200 |
|
37:40 | |
Kth Row of Pascal's Triangle | 225 |
|
28:32 | |
Spiral Order Matrix II | 225 |
|
48:40 | |
Pascal Triangle | 225 |
|
26:46 | |
Anti Diagonals | 225 |
|
41:46 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Triplets with Sum between given range | 200 |
|
76:31 | |
Balance Array | 200 |
|
63:01 | |
Find Duplicate in Array | 450 |
|
40:13 | |
Maximum Consecutive Gap | 450 |
|
58:46 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Sort array with squares! | 200 |
|
31:22 | |
Largest Number | 225 |
|
70:26 | |
Rotate Matrix | 300 |
|
60:26 | |
Next Permutation | 300 |
|
63:13 | |
Find Permutation | 300 |
|
56:00 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Occurence of Each Number | 200 |
|
28:20 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Noble Integer | 200 |
|
43:30 | |
Reorder Data in Log Files | 200 |
|
49:31 | |
Set Intersection | 200 |
|
57:14 | |
Wave Array | 225 |
|
22:08 | |
Hotel Bookings Possible | 225 |
|
66:06 | |
Max Distance | 250 |
|
68:14 | |
Maximum Unsorted Subarray | 250 |
|
68:52 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Set Matrix Zeros | 300 |
|
48:04 | |
Maximum Sum Square SubMatrix | 300 |
|
58:56 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
First Missing Integer | 300 |
|
64:38 | |
Repeat and Missing Number Array | 350 |
|
63:55 | |
N/3 Repeat Number | 600 |
|
68:22 |