This document discusses the time complexity of common sorting algorithms. Insertion sort has best-case complexity of O(n) when elements are already sorted, and worst-case of O(n^2) when elements are reverse sorted. Mergesort has complexity of O(nlogn). Quicksort has best-case of O(nlogn) when partitioning splits arrays evenly, but worst-case of O(n^2) when it splits arrays with very uneven element counts.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online from Scribd
This document discusses the time complexity of common sorting algorithms. Insertion sort has best-case complexity of O(n) when elements are already sorted, and worst-case of O(n^2) when elements are reverse sorted. Mergesort has complexity of O(nlogn). Quicksort has best-case of O(nlogn) when partitioning splits arrays evenly, but worst-case of O(n^2) when it splits arrays with very uneven element counts.
This document discusses the time complexity of common sorting algorithms. Insertion sort has best-case complexity of O(n) when elements are already sorted, and worst-case of O(n^2) when elements are reverse sorted. Mergesort has complexity of O(nlogn). Quicksort has best-case of O(nlogn) when partitioning splits arrays evenly, but worst-case of O(n^2) when it splits arrays with very uneven element counts.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online from Scribd
This document discusses the time complexity of common sorting algorithms. Insertion sort has best-case complexity of O(n) when elements are already sorted, and worst-case of O(n^2) when elements are reverse sorted. Mergesort has complexity of O(nlogn). Quicksort has best-case of O(nlogn) when partitioning splits arrays evenly, but worst-case of O(n^2) when it splits arrays with very uneven element counts.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online from Scribd