IDNLearn.com offers a collaborative platform for sharing and gaining knowledge. Join our community to access reliable and comprehensive responses to your questions from experienced professionals.

Which sorting algorithm is known for having the worst-case time complexity of O(n²) but performs well on small or nearly sorted datasets?
A) Bubble sort
B) Merge sort
C) Quick sort
D) Insertion sort