# List of Sorting Algorithms

May 08, 2019

This topic is one of the most common studied. When somebody started preparation of coding interviews. Sorting algorithms would in his top 2 topics. Even typical computer science graduate study sorting algorithms 3-4 times before they complete graduation.

## Why you should study Sorting Algorithms

• These are one of the most fundamental building block which helps in other complex algorithms.
• If you understand different tricks and basics around these algorithms, you can solve many-many more complex problems. Or, you can utilize the code somewhere.
• Most common techniques Divide and Conquer, covers few sorting algorithms. Which gives you more understanding of Divide and Conquer algorithms.
• In other computational algorithms, you must be using one of sorting algorithms either directly or indirectly.
• These are used in database queries

And, the list is endless.

## Which algorithm to study?

There are lot of sorting algorithms available, if you search in wikipedia. But, you should consider reading few of them. In below section, I will mention the important ones.

## Different Sorting Algorithms

There are lot of Sorting algorithms out there. I’ve categorized them as below:

### Most Basic Ones

Very basic ones. You should consider reading them at least once.

### Most Used and Optimized algorithms

Below algorithms must be on your tips.

• Merge Sort
• Quick Sort
• Heap Sort

### Other Algorithms

You should be familiar with these algorithms, although not much deep knowledge is required.

• Bucket Sort
• Counting Sort

### Time complexities of Sorting Algorithms

Algorithms Average(Expected) Running time Worst Running time
Insert Sort O(n^2) O(n^2)
Bubble Sort O(n^2) O(n^2)
Selection Sort O(n^2) O(n^2)
Quick Sort O(n log n) O(n^2)
Merge Sort O(n log n) O(n log n)
Heap Sort O(n log n) O(n log n)

## Similar Posts

### Young Tableau problem - Cormen

Young Tableau A a X b matrix is Young Tableau if all rows(from left to right…

### Rotate Image - Leet Code Solution

Problem Statement You are given an n x n 2D matrix representing an image, rotate…

### Longest Common Prefix - Leet Code Solution

Problem Statement Write a function to find the longest common prefix string…

### Find the maximum sum of any continuous subarray of size K

Introduction You are given an array of integers with size N, and a number K…

### Integer to Roman conversion - Leet Code Solution

Problem Statement Roman numerals are represented by seven different symbols: I…

In this post, we will see some of the frequently used concepts/vocabulary in…

## Latest Posts

### Jenkins Pipeline with Jenkinsfile - How To Schedule Job on Cron and Not on Code Commit

Introduction In this post we will see following: How to schedule a job on cron…

### How to Git Clone Another Repository from Jenkin Pipeline in Jenkinsfile

Introduction There are some cases, where I need another git repository while…

### How to Fetch Multiple Credentials and Expose them in Environment using Jenkinsfile pipeline

Introduction In this post, we will see how to fetch multiple credentials and…

### Jenkins Pipeline - How to run Automation on Different Environment (Dev/Stage/Prod), with Credentials

Introduction I have an automation script, that I want to run on different…

### Jenkinsfile - How to Create UI Form Text fields, Drop-down and Run for Different Conditions

Introduction I had to write a CICD system for one of our project. I had to…

### Java Log4j Logger - Programmatically Initialize JSON logger with customized keys in json logs

Introduction Java log4j has many ways to initialize and append the desired…