# Algorithm

Learn different algorithms with detailed explanations and diagrams.

## C Program to Count Number of Prime Numbers in a Given Range

Write a C program to count number of prime numbers in a given range. Naive Approach, using Sieve of Eratosthenes and using Dynamic Programming.

## Sieve of Eratosthenes

Sieve of Eratosthenes is an ancient algorithm that is used to find prime numbers up to a given limit. It can be used to find prime numbers efficiently.

## Binary Search real life examples

In this article, we will discuss some real life examples of binary search. We use binary search in our real lives without even knowing.

## Write a Java Program to Sort an Array by using Bubble Sort algorithm

Write a Java Program to Sort an Array by using Bubble Sort algorithm in both ascending order and descending order. Bubble Sort in Java.

## C++ Vector Quicksort

In this article, we will learn how to sort C++ vector using quicksort. Write a C++ Program to perform Quicksort in vector. C++ vector Quicksort.

## Recursive Binary Search Algorithm Pseudocode

Recursive Binary Search Algorithm Pseudocode in both Ascending order and descending order. Pseudo code for recursive binary search algorithm.

## C++ Merge Sort Vector

C++ Merge Sort vector. Write a Program in in c++ to Merge Sort a vector. Sort Vectors using merge sort in c++. Merge Sort vector into a sorted vector c++.

## Linear Search

Linear Search or Sequential Search is a searching algorithm. It can be implemented iteratively (without recursion) or recursively (using recursion).

## Why Binary Search is Preferred over Ternary Search?

Binary search and Ternary search algorithms are used to search an element in a sorted array. Binary search reduces the array by 1/3 on each iteration whereas Ternary search reduced array size by 1/3 on each iteration. The Time complexity of Binary Search is log2(N).The Time complexity of Ternary Search is log3(N). Ternary search should …

## Ternary Search

Ternary search is a searching algorithm that searches an element in a sorted array. Algorithm Ternary search works similar to Binary search. The only difference is instead of dividing the array into 2 parts, the array is divided into three parts and 2 parts are rejected on each iteration. That is, the array is reduced …