1 minute to read - Mar 30, 2023

Explain concept as a poem

VISIT
Explain worst case complexity of quicksort as a shakespearan sonnet

In quicksort, the worst case complexity

Is O(n^2), a fate most dire and dreary

For when the list is presorted with great care

The pivot point becomes the first or last entry

The partitioning then becomes less fair

As one sublist grows and the other withers

The algorithm then becomes quite contrary

To all its goals of sorting in a hurry

So when the list is sorted or near reverse

Quicksort's worst case complexity will curse

The speed at which it can perform its task

But with a random pivot, it can outdo all

Other sorting algorithms, quick as a flash

In the average case, its speed will stand tall

Article source
loading...