Python programming – Sieve of Eratosthenes – Mathematical Algorithms – Given a number n, print all primes smaller than or equal to n.For example, if n.
Algorithm
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
Detect if two integers have opposite signs – Bit Algorithm – Given two signed integers, write a function that returns true if the signs of given integers.
Find the element that appears once – Bit Algorithm – Given an array where every element occurs three times, except one element which occurs only once. Expected time complexity is O(n) and O(1) extra space.
C Programming-Print all combinations of points that can compose – Mathematical Algorithms -You can win three kinds of basketball points, 1 point, 2 points.