Insertion Sort Algorithm

Insertion sort is a simple sorting algorithm which work mechanism in which sorted array is built having one item at a time.  The array elements are compared with each other sequentially Upon each iteration, an item is taken from the list and inserted into the correct position by comparison with next elements of an array. This process is repeated until we reach the last item … Continue reading Insertion Sort Algorithm

Selection Sort Algorithm

Selection sort is a simple sorting algorithm. Divide the array into two arrays, sorted and unsorted. Then   selects the smallest element from an unsorted list in each iteration and places that element at the sorted array one by one. This process continues moving unsorted array boundary by one element to the sorted array. Let’s consider an array with values { 12, 4, 45, 2, … Continue reading Selection Sort Algorithm

Quick Sort Algorithm

Quicksort is an algorithm use divide and conquer approach in which the array is split into subarrays by selecting value from array as pivot and then the sub-arrays are recursively called to sort the elements. Steps for quick sort are 1. Pick an element from an array called a pivot. (Different versions of Quicksort pick pivot in different ways) 2. Partitioning- Divide the array into two … Continue reading Quick Sort Algorithm

Bubble Sort algorithm

Bubble Sort is the simplest sorting algorithm that works by iterating through the array from the first index to the last index and comparing adjacent elements and then swapping them if they appear in the wrong order. I.e. If the next element is smaller than the current element, they are swapped.  As it iterates for all the array elements with repeatedly swapping the adjacent elements. … Continue reading Bubble Sort algorithm

Deterministic Algorithm

A deterministic algorithm is an Algorithm in which for a given input, the computer will always produce the same output by going through the same states that also means for given the same input, it will take the same amount of time/memory/resources every time it run. In other words, I would say A deterministic algorithm is simply an algorithm that has a predefined output. For instance, … Continue reading Deterministic Algorithm