Data Structures and Algorithms — Complete Course Notes (BCA 3rd Sem)
Comprehensive lecture notes on asymptotic analysis, stacks, queues, linked lists, trees, graphs, and sorting algorithms for TU BCA.
Data Structures and Algorithms · CACS201 · Semester 3
Unit 5•Unit 5 of 5
Unit 5: 4. Sorting Algorithms Comparison
| Algorithm | Best Case | Average Case | Worst Case | Space Complexity | Stable? |
|---|---|---|---|---|---|
| Bubble Sort | O(n) | O(n2) | O(n2) | O(1) | Yes |
| Insertion Sort | O(n) | O(n2) | O(n2) | O(1) | Yes |
| Merge Sort | O(n \log n) | O(n \log n) | O(n \log n) | O(n) | Yes |
| Quick Sort | O(n \log n) | O(n \log n) | O(n2) | O(\log n) | No |
| Heap Sort | O(n \log n) | O(n \log n) | O(n \log n) | O(1) | No |
Data Structures and Algorithms Complete Course (freeCodeCamp)
Open lesson pageLesson videos
Related video lessons
Practice questions
- What is the worst-case time complexity of Quick Sort algorithm? (a) O(n) (b) O(n log n) (c) O(n^2) (d) O(log n)objective · 1 marks
- Differentiate between Linear Queue and Circular Queue. Explain how modulo arithmetic prevents false overflow.short · 5 marks
