Nepal's open education portal

EduNepalEduNepal

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

BCA Curriculum 2079

Unit 5•Unit 5 of 5

Unit 5: 4. Sorting Algorithms Comparison

AlgorithmBest CaseAverage CaseWorst CaseSpace ComplexityStable?
Bubble SortO(n)O(n2)O(n2)O(1)Yes
Insertion SortO(n)O(n2)O(n2)O(1)Yes
Merge SortO(n \log n)O(n \log n)O(n \log n)O(n)Yes
Quick SortO(n \log n)O(n \log n)O(n2)O(\log n)No
Heap SortO(n \log n)O(n \log n)O(n \log n)O(1)No

Related video lessons

View all →

Practice questions

View all →
  • 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

View all questions for this subject →

← Back to all notes