C Programming – Given a number, find the next smallest palindrome – Mathematical Algorithms – For example, if the input number is “2 3 5 4 5”.
Add two numbers without using arithmetic operators – Bit Algorithm – Sum of two bits can be obtained by performing XOR (^) of the two bits.
C++ Programming-Backtracking Set 5 – Backtracking – Given an undirected graph and a number m, determine if the graph can be colored with most m colors such that no two adjacent vertices of the graph are colored with same color.
Python programming – Sieve of Eratosthenes – Mathematical Algorithms – Given a number n, print all primes smaller than or equal to n.For example, if n.
Swap bits in a given number – Bit Algorithm – Given a number x and two positions (from right side) in binary representation of x, write a function that swap
Java programming – Sieve of Eratosthenes – Mathematical Algorithms – Given a number n, print all primes smaller than or equal to n.For example, if n is 10.
C programming – Sieve of Eratosthenes – Mathematical Algorithms – Given a number n, print all primes smaller than or equal to n. if n is 10, the output .
Count total set bits in all numbers from 1 to n – Bit Algorithm – In other words, if the control goes inside while loop of getNextLeftmostBit().
C Programming – Magic Square – Mathematical Algorithms – A magic square of order n is an arrangement of n^2 numbers, usually distinct integers, in a square.
C Programming Fibonacci numbers – Mathematical algorithms – The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13