- & - You can use it to check if a number is divisible by 2.
- ^ - This is the XOR operator. XOR has property : the same number XOR the same number equal to zero.
- 2 power n can be done in constant time with bit operation <<. Ex. (1<<n)
- Multiplication and division are slower then bit operations. (n >>= 1) is equivalent as n /= 2. (n <<= 1) is equivalent as n *= 2.
- the or bit operation
- n++ - increment n by 1
- n-- - subtracts n by 1
- ++n - increment n by 1
- --n - subtracts n by 1
- n%m = r - r is the remainder of the division n and m
- *, -, /, + - basic arithmetic operators
Tuesday, 12 March 2019
Basic Operators
Today we will be talking about operations. There are many different types of operations :
Subscribe to:
Post Comments (Atom)
std::next_permutation(arr.begin(),arr.end());
What is next_permutation(a.begin(),a.end()) ? Next permutation is like what its name says, finds the next permutation of a and assigns ...
-
Usage of __int128_t: supports really big intermediate numbers, from -2^128 + 1 to 2^128 - 1 it has 128 bits Usage of __float128 : ...
-
This is one of the not interactive question. (2 out of 4 questions are interactive questions). You can try it ! InfO(1) CUP 2019 Third ...
-
There are many different distances but today we will be talking about Manhattan distance and Euclidean distance. Mahattan distance is based ...
No comments:
Post a Comment