Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
math Directory Reference

Files

file  approximate_pi.cpp
 Implementation to calculate an estimate of the number π (Pi).
 
file  area.cpp
 Implementations for the area of various shapes.
 
file  armstrong_number.cpp
 Program to check if a number is an Armstrong/Narcissistic number in decimal system.
 
file  binary_exponent.cpp
 C++ Program to find Binary Exponent Iteratively and Recursively.
 
file  binomial_calculate.cpp
 Program to calculate Binomial coefficients
 
file  check_amicable_pair.cpp
 A C++ Program to check whether a pair of number is amicable pair or not.
 
file  check_factorial.cpp
 A simple program to check if the given number is a factorial of some number or not.
 
file  check_prime.cpp
 Reduced all possibilities of a number which cannot be prime. Eg: No even number, except 2 can be a prime number, hence we will increment our loop with i+6 jumping and check for i or i+2 to be a factor of the number; if it's a factor then we will return false otherwise true after the loop terminates at the terminating condition which is (i*i<=num)
 
file  complex_numbers.cpp
 An implementation of Complex Number as Objects.
 
file  double_factorial.cpp
 Compute double factorial: \(n!!\).
 
file  eulers_totient_function.cpp
 C++ Program to find Euler's Totient function.
 
file  extended_euclid_algorithm.cpp
 GCD using [extended Euclid's algorithm] (https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm)
 
file  factorial.cpp
 C++ program to find factorial of given number.
 
file  fast_power.cpp
 Faster computation for \(a^b\).
 
file  fibonacci.cpp
 Generate fibonacci sequence.
 
file  fibonacci_fast.cpp
 Faster computation of Fibonacci series.
 
file  fibonacci_large.cpp
 Computes N^th Fibonacci number given as input argument. Uses custom build arbitrary integers library to perform additions and other operations.
 
file  fibonacci_matrix_exponentiation.cpp
 This program computes the N^th Fibonacci number in modulo mod input argument .
 
file  fibonacci_sum.cpp
 An algorithm to calculate the sum of Fibonacci Sequence: \(\mathrm{F}(n) + \mathrm{F}(n+1) + .. + \mathrm{F}(m)\).
 
file  finding_number_of_digits_in_a_number.cpp
 [Program to count digits in an integer](https://www.geeksforgeeks.org/program-count-digits-integer-3-different-methods)
 
file  gcd_iterative_euclidean.cpp
 Compute the greatest common denominator of two integers using iterative form of Euclidean algorithm
 
file  gcd_of_n_numbers.cpp
 This program aims at calculating the GCD of n numbers by division method.
 
file  gcd_recursive_euclidean.cpp
 Compute the greatest common denominator of two integers using recursive form of Euclidean algorithm
 
file  integral_approximation.cpp
 Compute integral approximation of the function using Riemann sum
 
file  integral_approximation2.cpp
 Monte Carlo Integration
 
file  inv_sqrt.cpp
 Implementation of the inverse square root Root.
 
file  large_factorial.cpp
 Compute factorial of any arbitratily large number/.
 
file  large_number.h [code]
 Library to perform arithmatic operations on arbitrarily large numbers.
 
file  largest_power.cpp
 Algorithm to find largest x such that p^x divides n! (factorial) using Legendre's Formula.
 
file  lcm_sum.cpp
 An algorithm to calculate the sum of LCM: \(\mathrm{LCM}(1,n) + \mathrm{LCM}(2,n) + \ldots + \mathrm{LCM}(n,n)\).
 
file  least_common_multiple.cpp
 
file  magic_number.cpp
 A simple program to check if the given number is a magic number or not. A number is said to be a magic number, if the sum of its digits are calculated till a single digit recursively by adding the sum of the digits after every addition. If the single digit comes out to be 1,then the number is a magic number.
 
file  miller_rabin.cpp
 
file  modular_division.cpp
 An algorithm to divide two numbers under modulo p Modular Division
 
file  modular_exponentiation.cpp
 C++ Program for Modular Exponentiation Iteratively.
 
file  modular_inverse_fermat_little_theorem.cpp
 C++ Program to find the modular inverse using Fermat's Little Theorem
 
file  n_bonacci.cpp
 Implementation of the N-bonacci series.
 
file  n_choose_r.cpp
 Combinations n choose r function implementation
 
file  ncr_modulo_p.cpp
 This program aims at calculating nCr modulo p.
 
file  number_of_positive_divisors.cpp
 C++ Program to calculate the number of positive divisors.
 
file  power_for_huge_numbers.cpp
 Compute powers of large numbers.
 
file  power_of_two.cpp
 Implementation to check whether a number is a power of 2 or not.
 
file  prime_factorization.cpp
 Prime factorization of positive integers.
 
file  prime_numbers.cpp
 Get list of prime numbers.
 
file  primes_up_to_billion.cpp
 Compute prime numbers upto 1 billion.
 
file  realtime_stats.cpp
 Compute statistics for data entered in rreal-time.
 
file  sieve_of_eratosthenes.cpp
 Get list of prime numbers using Sieve of Eratosthenes.
 
file  sqrt_double.cpp
 Calculate the square root of any positive real number in \(O(\log N)\) time, with precision fixed using bisection method of root-finding.
 
file  string_fibonacci.cpp
 This Programme returns the Nth fibonacci as a string.
 
file  sum_of_binomial_coefficient.cpp
 Algorithm to find sum of binomial coefficients of a given positive integer.
 
file  sum_of_digits.cpp
 A C++ Program to find the Sum of Digits of input integer.
 
file  vector_cross_product.cpp
 Calculates the Cross Product and the magnitude of two mathematical 3D vectors.
 
file  volume.cpp
 Implmentations for the volume of various 3D shapes.