Quick sort explained with simple example

Quick sort is one of the fastest sorting algorithm, which works on Divide and Conquer algorithm. In this sorting algorithm, an element is picked as a pivot element and list is divided into sub-lists around the pivot element. These divided sub-lists finally sorted into which results into sorted initial list.

Pros:
1) Faster algorithm and best performance O(nlogn) is for worst distribution case scenario.
2) Simple implementation due to recursive nature.
3) No extra space is needed.

Cons:
1) Worst case scenario performance is O(n*n).
2) Not good for Linked list kind of sorting data where memory is not contiguous.

(more…)

Quick sort explained with simple example Read More

Sorting algorithms explained in simple manner

Sorting is an operation in computer science via which data is being arranged in an ordered sequence. There are lots of efficient algorithms are already present to perform sorting operation which we are going to discuss here.

Some of the most used sorting algorithms are as follows:

1) Bubble Sort
2) Insertion Sort
3) Merge Sort
4) Selection Sort
5) Quick Sort
6) Heap Sort

Comparison of various Sorting algorithms in terms of time complexity for best and worst case:

(more…)

Sorting algorithms explained in simple manner Read More