if we want to find prime numbers up to some predefined integer n, there are some steps to find the prime numbers. (trial division) find primes (int arr[]) define empty list for from i = 2 to i = n if isPrime (i) if true (add i to list) Implementation (Trial division) in c++ #include <iostream>… Continue reading Sieve of Eratosthenes Algorithm

# Category: Algorithms

# Binary Search

the simple searching algorithm for searching an element in array is Linear Search and the time complexity for linear search is o(n). Binary search is one of the fundamental algorithms in computer science. and an effective algorithm as compared to linear search . Binary search algorithm in C++ relies on a divide and conquer strategy to find a… Continue reading Binary Search