# searching algorithm

Articles related to different searching algorithms.

## C++ Program of Binary Search Using Templates

In this post, we will discuss binary search algorithm implementation using function templates in C++. If you don’t know how binary search works, then read Binary Search Algorithm. Program of Binary Search Using Templates Output Program of Binary Search Using Templates (recursive) Output ReadFind all subsets of an arrayProgram to count prime numbers in given …

## Recursive Binary Search Algorithm Pseudocode

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

## 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 …

## Binary Search

Binary search is algorithm that searches an element in a sorted array in O(logN) complexity. It can be implemented using recursion or without recursion.