1. Sorting Algorithms Algorithm Time Complexity (Best / Avg / Worst) Space Complexity Stable? When to Use Bubble Sort O(n) / O(n²) / O(n²) O(1) ✅ Yes Simple, but inefficient for large datasets Selection Sort O(n²) / O(n²) / O(n²) O(1) ❌ No When swapping is costly, but still inefficient Insertion Sort O(n) / O(n²) / O(n²) O(1) ✅ Yes Works well for nearly sorted arrays Merge Sort O(n log n) / O(n log n) / O(n log n) O(n) ✅ Yes Large datasets, stable sorting Quick Sort O(n log n) / O(n log n) / O(n²) O(log n) ❌ No Fastest for general use, but unstable Heap Sort O(n log n) / O(n log n) / O(n log n) O(1) ❌ No Best when you n...