Algorithms

AlgorithmWorst 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

To check

Boyer Moore Algorithm for Pattern Searching

Masters theorem

Books to read

Algorithm Design By Jon Kleinberg And Eva Tardos

Elements of programming interviews

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: