Arnab Chakraborty has Published 4293 Articles

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

Arnab Chakraborty

Arnab Chakraborty

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

1K+ Views

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 shutdown a system?

Arnab Chakraborty

Arnab Chakraborty

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

777 Views

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

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

Arnab Chakraborty

Arnab Chakraborty

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

165 Views

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

166 Views

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

671 Views

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

458 Views

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

C Program for Basic Euclidean algorithms?

Arnab Chakraborty

Arnab Chakraborty

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

252 Views

Here we will see the Euclidean algorithm to find the GCD of two numbers. The GCD (Greatest Common Divisor) can easily be found using Euclidean algorithm. There are two different approach. One is iterative, another one is recursive. Here we are going to use the recursive Euclidean algorithm.AlgorithmEuclideanAlgorithm(a, b)begin   ... Read More

C Program for Egg Dropping Puzzle - DP-11?

Arnab Chakraborty

Arnab Chakraborty

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

353 Views

This is a famous puzzle problem. Suppose there is a building with n floors, if we have m eggs, then how can we find the minimum number of drops needed to find a floor from which it is safe to drop an egg without breaking it.There some important points to ... Read More

Generic keyword in C ?

Arnab Chakraborty

Arnab Chakraborty

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

349 Views

As we know that the Macros are used in C or C++, but there is no facility for type checking. The macros can take any type of argument in it. The following example will show this case clearly.Example Live Demo#include #define INCREMENT(X) ++X main() {    int x = 5; float ... Read More

What is a function specifier in C?

Arnab Chakraborty

Arnab Chakraborty

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

654 Views

In C and C++ there are some function specifiers. The function specifiers are used to specify the functions property. C++ has inline function specifier. In C there is _Noreturn function specifier. This is used to denote that one function will not return anything.Example Live Demo#include int myAdd(int a, int b){   ... Read More

Advertisements