## Two Pointer Approach: An Efficient Technique

In this article we will discuss a linear and constant space technique to solve the programming questions. Two pointer Approach is an efficient technique to solve the problem with optimized time and space complexity. Two Pointer Approach Algorithm is mostly used for solving the array problems, where pointers are actually array indexes. Whenever the solution … Read more

## Insertion Sort – A Stable Sorting Algorithm

Have you ever played card? If yes, then you’ll feel that insertion sort is somewhat similar to arranging cards in your hand. While arranging cards you’ll place the first card in your hand. After picking the second card you’ll compare it with the existing card and place it in the correct order. In the same … Read more

## QuickSort Algorithm

Here you’ll learn how to write a program for quicksort algorithm understand its theory, and using an example learn how its implemented. Contrary to the name, this isn’t the fastest sorting algorithm out there, this will be clearer once the time complexity of QuickSort is discussed later. But first, let’s start with the algorithm approach. … Read more

## Merge Sort Algorithm: An Efficient Sorting Approach

In this article, we will learn about Merge Sort Algorithm. There are many well known sorting algorithms but the cool thing about Merge sort is that it takes O(log n) time complexity even in the worst case. Merge sort is a sorting algorithm based on the Divide and Conquer technique. The approach is to transform the … Read more

## Bubble Sort – A Stable Algorithm

Bubble sort is one of the simplest sorting algorithms that is based on swapping adjacent elements if they are present in the wrong order. It is a stable algorithm since it preserves the order of the original vector in case of repetition. Bubble Sort C++ Algorithm Implementation Dry Run Input: nums = [5, 2, 10, … Read more

## Rotating Elements of a Matrix by 90 Degrees

We’ll understand rotating elements of a matrix by 90 degrees, without using extra space and write the program to implement the same. Directly placing the elements of a matrix row by row in a temporary matrix is a reasonable solution, but the space complexity doubles in that case, when we have large sets of data, … Read more

## Program for Spiral Traversal of a Matrix

We’ll learn to write a program for spiral traversal of a matrix of size m x n, which does mean as it sounds, we’ll start the corner of the matrix and traverse in a spiral towards the center of the matrix. Understanding the question, and output Given: Matrix, SizeOutput: Printing elements in a line using … Read more

## Median of Two Sorted Arrays | Leetcode Problem #4

In this question, given two sorted arrays nums1 and nums2 of size m and n respectively, you have to return the median of two sorted arrays Goal: The overall run time complexity should be O(log(m+n)) Naive Solution to Find Median of Two Sorted Arrays In this solution, we create a vector and then insert all … Read more

## Program to Search in Row-wise and Column-wise Sorted Matrix

Program to search in a row-wise column-wise sorted matrix i.e. printing the location of an element(if it exists) in a row and column-wise sorted matrix.

## Find Repeating Element in Array| Leetcode #287

This article will discuss various approaches to find the element repeating more than once in an array, from naive to most efficient. Problem statement: Given an array of size n where each element is in the range [1,n-1], exactly one element repeats any no. of times in the array. Find that repeating element. Input: arr = … Read more