## C++ Program to Implement Sieve of Eratosthenes

This C++ program to implement Sieve of Eratosthenes. The program initializes an integer array with all the elements initialized to 0. Then the algorithm follows where the each non-prime element’s index is marked as 1 inside the nested loops. The prime numbers are those whose value of index is marked as 0. Here is the … Read more

## C++ Program to Solve any Linear Equation in One Variable

This is a C++ Program that Solves any Linear Equation in One Variable. Problem Description The Problem states that given a linear equation in one variable of the form aX + b = cX + d where a,b,c,d are provided as input, we need to determine the appropriate value of X. Problem Solution Solving the … Read more

## C++ Program to Compute Discrete Fourier Transform using Fast Fourier Transform Approach

This is a C++ Program to perform Fast Fourier Transform. A fast Fourier transform (FFT) is an algorithm to compute the discrete Fourier transform (DFT) and its inverse. Fourier analysis converts time (or space) to frequency and vice versa; an FFT rapidly computes such transformations by factorizing the DFT matrix into a product of sparse … Read more

## C++ Program to Implement Fisher-Yates Algorithm

This is a C++ Program to shuffle array using Fisher-Yates algorithm. The Fisher–Yates shuffle (named after Ronald Fisher and Frank Yates), also known as the Knuth shuffle (after Donald Knuth), is an algorithm for generating a random permutation of a finite set—in plain terms, for randomly shuffling the set. A variant of the Fisher–Yates shuffle, … Read more

## C++ Program to Solve the Fractional Knapsack Problem

This is a C++ Program to solve fractional knapsack. The knapsack problem or rucksack problem is a problem in combinatorial optimization: Given a set of items, each with a mass and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to … Read more

## C++ Program to Implement Gauss Jordan Elimination

This is a C++ Program to implement Gauss Jordan Elimination algorithm. In linear algebra, Gaussian elimination (also known as row reduction) is an algorithm for solving systems of linear equations. It is usually understood as a sequence of operations performed on the associated matrix of coefficients. This method can also be used to find the … Read more

## C++ Program to Implement Gauss Seidel Method

This is a C++ Program to implement Gauss Seidel Method. In numerical linear algebra, the Gauss–Seidel method, also known as the Liebmann method or the method of successive displacement, is an iterative method used to solve a linear system of equations. Here is source code of the C++ Program to Implement Gauss Seidel Method. The … Read more

## C++ Program to Find GCD of Two Numbers Using Recursive Euclid Algorithm

This is a C++ Program to find GCD of two numbers using Recursive Euclid Algorithm. In mathematics, the Euclidean algorithm, or Euclid’s algorithm, is a method for computing the greatest common divisor (GCD) of two (usually positive) integers, also known as the greatest common factor (GCF) or highest common factor (HCF). It is named after … Read more

## C++ Program to Generate Random Hexadecimal Bytes

This is a C++ Program to generate random hex bytes. The idea is to genrate decimal number first and convert it to hexadecimal. Here is source code of the C++ Program to Generate Random Hexadecimal Bytes. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. … Read more 