# Sorting

## Sorting Algorithms in C++

• DSA

Sorting algorithms are cool. But, every time I learn or refer to any algorithm in my head or watch a YouTube video, I can understand and recall how it works but, my brain starts yelling – write the code! write the code! If you are trying to learn or understand… Read More »Sorting Algorithms in C++

## Separate 0s and 1s – O(N) Single Iteration

• DSA

Given an array of numbers consisting of only zeroes and ones, and we need to separate 0s and 1s. This problem can be solved in many ways like sorting and performing basic swapping but I learned a method to do all of this in a single iteration. So, let’s do… Read More »Separate 0s and 1s – O(N) Single Iteration

## Remove Duplicates from a Sorted Linked List

• DSA

Remove duplicates from a sorted linked list. In this problem, as the list is already sorted, the duplicates are next to one another and easy to identify. However, as we are dealing with a linked list we need to connect the nodes carefully. Example Input Output, after removing duplicates Solution… Read More »Remove Duplicates from a Sorted Linked List

## Bubble Sort Algorithm

• DSA

Bubble sort is one of the simple sorting techniques and it is also easier to code and understand. Bubble sort follows the simple principle of comparing two adjacent elements and swapping them according to our desired order. How Bubble Sort works? Consider the below example where we try to sort… Read More »Bubble Sort Algorithm