The core idea behind sorting a stack using recursion is to:
- Remove elements from the stack one by one.
- Recursively sort the remaining stack.
- Insert the removed element at the correct position in the sorted stack.
| SMALLEST INFORMATION UNIT: | |
| 1 NIBBLE = 4 BITS | |
| 1 BYTE = 8 BITS | |
| 1 KILOBYTE (KB) = 8 KILOBITS = 1,024 BYTES = 2¹⁰ BYTES | |
| 1 MEGABYTE (MB) = 8 MEGABITS = 1,048,576 BYTES = 2²⁰ BYTES | |
| 1 GIGABYTE (GB) = 8 GIGABITS = 1,073,741,824 BYTES = 2³⁰ BYTES | |
| 1 TERABYTE (TB) = 8 TERABITS = 1,099,511,627,776 BYTES = 2⁴⁰ BYTES | |
| 1 PETABYTE (PB) = 8 PETABITS = 1,125,899,906,842,624 BYTES = 2⁵⁰ BYTES | |
| Programming Languages Levels: |
Question: 349. Intersection of Two Arrays
Intution:
Time Complexity:
Space Complexity:
Solution:
Question: Row with max 1s
Intution: Not exactly binary search but we can utilize the fact that it the row is sorted. We have to use 2 pointers approach.
Time Complexity:
Space Complexity:
Solution:
Question: Frequency In A Sorted Array
Intution:
Time Complexity:
Space Complexity:
Solution:
Question: Implement Lower Bound
Intution:
Time Complexity:
Space Complexity:
Solution:
Question: Implement Upper Bound
Intution:
Time Complexity:
Space Complexity:
Solution:
Question: 153. Find Minimum in Rotated Sorted Array
Intution:
Time Complexity:
Space Complexity:
Solution: