Insertion sort explained with simple example

Insertion sort is one of simplest sorting algorithm which traverse through the list, picking one item at a time and place it in its place in the final sorted list. This sorting algorithm contains (n – 1) traversal.

Pros:
1) Simple algorithm and hence efficient for small list of data.
2) No extra memory needed.
3) Good for cases when list is almost sorted (only few misplaced items).

Cons:
1) Very slow algorithm. Not good for very large set of data.

(more…)

Insertion 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