Sorting

AlgorithmWort caseAvg caseBest CaseStableIn-place?
Bubble sortO(n2)O(n2)O(n2)StableYes
Selection sortO(n2)O(n2)O(n2)Not StableYes
Insertion sortO(n2)O(n2)O(n)StableYes
Merge sortO(n log n)StableNo. Need auxiliary space
Quick sortO(n2)O(n log n)Not stableYes
Heap sortO(n log n)O(n log n)Not stableYes
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: