# Sort squares of a sorted array in linear runtime (O(n))

Given a sorted array that contains both negative and positive integers we aim to get its squares array in sorted orders. Let us understand this with an example. Let’s understand how we can solve this problem in linear time. To solve this in linear time, we have to take two handles which represent the startRead More »

# Heap Sort

Sort given array of integers in ascending/descending order using the Heap Sort algorithm. Heap Sort is also one of the most common sorting algorithms used in millions of applications. Heaping is a technique used in this algorithm to find the shortest number. Any new number added in heap will be heapify with complexity. Heap SortRead More »

# Merge Sort

Given an array of integer values aim is to sort them in ascending/descending order using the Merge Sort algorithm. Merge Sort is a high performing sorting technique similar to quicksort. This sorting algorithm works by using the divide and conquer method. Merge sort divides the input array into half parts recursively until it has 1Read More »

# Quicksort

Given an array of numbers aim is to sort them ascending/descending order using quick sort algorithm. Quick Sort is the most famous and one of my favorite search algorithm which is used in millions of software applications and systems. C++ programmings default std::sort() uses the quick sorting technique to sort the input. Quicksort algorithm techniqueRead More »

# Shell Sort

Given an array of integers and aim is to sort that array in ascending/descending order using shell sort algorithm. Shell Sort is an interesting sorting algorithm that works on top of insertion sort. But here in this algorithm the insertion intervals are not continuous. This interval will be defined based on a formula. There canRead More »

# Insertion Sort

Given an array of numbers aim is to sort those numbers in ascending/descending order using the Insertion Sort algorithm. Insertion Sort is a type of sorting algorithm where it starts with two numbers initially and makes them sort by moving all greater elements that the last element to the right side. By doing this forRead More »

# Selection Sort

Given an array of N, integers need to sort them in ascending/descending order using Selection Sort. Selection sort is a sorting algorithm which is similar to bubble sort, this Selection Sort algorithm reduces the number of swaps occurred in bubble sort. This sorting algorithm selects a maximum value by scanning N integers. In the endRead More »

# Bubble Sort

Given an array of integer values sort those values using bubble sort algorithm. Bubble Sort is a simple algorithm to sort an array of integers by comparing and swapping the side-by-side elements to keep the maximum element at the end for every iteration. Please check the below example for a better understanding. For better understandingRead More »