Arnab Chakraborty has Published 4529 Articles

C/C++ Program to Count set bits in an integer?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

Here we will see how we can check number of set bits in an integer number. The set bits are 1’s in the binary representation of a number. For an example the number 13 has three set bits 1101. So the count will be 3.To solve this problem, we will ... Read More

C/C++ Program to Find the Number Occurring Odd Number of Times?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

In this program we will see how we can get a number that is occurring odd number of times in an array. There are many different approaches. One of the easiest approach is performing ZOR operation. If a number is XORed with itself, it will be 0. So if a ... Read More

C/C++ program to shutdown a system?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

Here we will see how we can shut down the system by writing a simple C or C++ code. The shutdown process varies in different OS. If we are Linux user, we can use this terminal command to shut down.shutdown –P nowIf we are using Windows system, we can use ... Read More

Aliquot sum in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

Here we will see what is the Aliquot sum? The Aliquot sum of n is the sum of all perfect factors of a n except the n. For example, if the number is 20, then the perfect factors are (1, 2, 4, 5, 10). So the Aliquot sum is 22.One ... Read More

Alternate Primes till N in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

Here we will see how to print all alternate prime numbers till N. The alternate prime numbers are like below. Suppose N = 15. So the prime numbers till N are {2, 3, 5, 7, 11, 13}. The alternate prime numbers are {2, 5, 11}. Let us see how we ... Read More

Arithmetic Mean in c++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

The Arithmetic Mean is just the average of numbers. In this program we will see how we can find the arithmetic mean from a set of numbers. The function will take the number set, and the number of elements. Out task is just adding each element, then divide it by ... Read More

asin() function for complex number in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

Here we will see the asin() method for the complex numbers. The complex numbers can be used using complex header file. In that header file the asin () function is also present. This is complex version of normal asin () function. This is used to find complex arc sine of ... Read More

atan() function for complex number in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

Here we will see the atan() method for the complex numbers. The complex numbers can be used using complex header file. In that header file the atan() function is also present. This is complex version of normal atan() function. This is used to find complex arc tan of a complex ... Read More

BFS using STL for competitive coding in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

The Breadth First Search (BFS) traversal is an algorithm, which is used to visit all of the nodes of a given graph. In this traversal algorithm one node is selected and then all of the adjacent nodes are visited one by one. After completing all of the adjacent vertices, it ... Read More

C/C++ Program for Largest Sum Contiguous Subarray?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

An array of integers is given. We have to find sum of all elements which are contiguous. Whose sum is largest, that will be sent as output.Using dynamic programming we will store the maximum sum up to current term. It will help to find sum for contiguous elements in the ... Read More

Advertisements