# Sorting - Algorithms

In this section we will get in depth knowledge of Sorting Algorithms, including Sorting Algorithms interview questions with solution and Sorting Algorithms based logical problems.

We will also look into time and space complexity of different algorithms and problems based on Sorting.

These Sorting Algorithms based questions with complete explanation and implementation in Java are very helpful in cracking any software engineering interview.

## What is HeapSort Algorithm Example and Implementation

Heap sort is a Heap data structure based comparison sorting technique where we first find the maximum element and place the maximum element at the end. We repeat the same process for remaining elements.

## Insertion sort algorithm

Insertion sort algorithm is a simple sorting algorithm that works the way we sort playing cards in our hands and builds the final sorted array one item at a time.

## Bubble sort algorithm

Bubble Sort is the simplest sorting algorithm, where array is traversed from first element to last element to repeatedly swap the adjacent elements if they are in wrong order.

## Selection sort algorithm

Selection Sort is one of the simplest sorting algorithm, where array is traversed from first element to last element to repeatedly find the minimum element. In this way the array is divided into two sub-arrays sorted and unsorted, in each pass one element is added to sorted array from unsorted array.

## Quick Sort algorithm

QuickSort is a Divide and Conquer algorithm having an average O(n log n) time complexity, it's one of the most used sorting algorithms, especially in sort() functions of almost all programming languages library.

## Merge Sort algorithm

Merge Sort is one of the most efficient, Divide and Conquer sorting algorithms having an O(n log n) time complexity in all cases. In most implementations Merge Sort produce a stable sort.