Sorting Algorithms and Lower Bounds

Sorting Algorithms and Lower Bounds
Slide Note
Embed
Share

Complexities and hypotheses surrounding sorting algorithms like Insertion Sort, Merge Sort, and Heap Sort. Delve into lower bounds and comparisons in the realm of sorting algorithms, with a focus on the number of comparisons required for efficient sorting. Discover new hypotheses and analyses on the best-case scenarios for comparison-based sorting algorithms.

  • Sorting Algorithms
  • Lower Bounds
  • Hypotheses
  • Comparison-Based
  • Complexity

Uploaded on Mar 04, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Sorting Algorithms Insertion Sort: (n2) Merge Sort: (nlog(n)) Heap Sort: (nlog(n)) We seem to be stuck at (nlog(n)) Hypothesis: Every sorting algorithm requires (nlog(n)) time.

  2. Lower Bound Definitions Merge sort: (nlog(n)) on every input Insertion sort: 1, 2, 3, 4, , n-1, n O(n) time n, n-1, n-2, , 2, 1 O(n2) time Hypothesis: For every sorting algorithm A and every integer n, there is some input of length n on which A requires (nlog(n)) time.

  3. Proving Lower Bounds What if there is some absurd O(n) algorithm? E.g. Square every third element For every prime j, A[j] = 2^A[j] For every j, look up A[j] th word in the August 2013 New York Times Etc.

  4. Comparison sorting Want algorithms that work on any input e.g. insertion/merge/heap sort Think about sorting: uses comparisons. Comparison based sorting algorithm only relies on comparisons + moves Running time = (# of comparisons)

  5. New Hypothesis Every comparison-based sorting algorithm requires (nlog(n)) comparisons in the worst case.

  6. Required Comparisons O(nlog(n)) comparisons suffices merge sort, heap sort Trivial: need (n/2) comparisons

  7. New Hypothesis Every comparison-based sorting algorithm requires (nlog(n)) comparisons in the worst case. Observation: Tree of height k has at most 2kleaves.

  8. Average Case Analysis (nlog(n)) comparisons in worst case Merge sort: always (nlog(n)) Insertion sort: sometimes (n), sometimes (n2) Can we get the best of both? Sometimes (nlog(n)), usually O(n)? NO: need (nlog(n)) comparisons on average among all possible inputs.

More Related Content