Skip to content

Category Archives: C++ Programs

Background : Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Following is… Read More
Cycle sort is an in-place sorting Algorithm, unstable sorting algorithm, a comparison sort that is theoretically optimal in terms of the total number of writes… Read More
Given two integer numbers, the task is to find the count of all common divisors of given numbers. Input : a = 12, b =… Read More
BogoSort also known as permutation sort, stupid sort, slow sort, shotgun sort or monkey sort is a particularly ineffective algorithm based on generate and test… Read More
This is basically a variation of bubble-sort. This algorithm is divided into two phases- Odd and Even Phase. The algorithm runs until the array elements… Read More
Algorithm Steps If you are at the start of the array then go to the right element (from arr[0] to arr[1]). If the current array… Read More
Cocktail Sort is a variation of Bubble sort. The Bubble sort algorithm always traverses elements from left and moves the largest element to its correct… Read More
Bitonic Sequence A sequence is called Bitonic if it is first increasing, then decreasing. In other words, an array arr[0..n-i] is Bitonic if there exists… Read More
Bitonic Sequence A sequence is called Bitonic if it is first increasing, then decreasing. In other words, an array arr[0..n-i] is Bitonic if there exists… Read More
Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements and the number of possible key… Read More
Comb Sort is mainly an improvement over Bubble Sort. Bubble sort always compares adjacent values. So all inversions are removed one by one. Comb Sort… Read More
Given a number, find a representation of number as sum of non-consecutive Fibonacci numbers.Examples: Input: n = 10 Output: 8 2 8 and 2 are… Read More
In shellSort, we make the array h-sorted for a large value of h. We keep reducing the value of h until it becomes 1. An… Read More
Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order. This algorithm is… Read More
Given two numbers, write a C program to swap the given numbers. Input : x = 10, y = 20; Output : x = 20,… Read More

Start Your Coding Journey Now!