Tag: algorithm

Hacking with an algorithm to find prime factor of a number
$./app Sign detection [1] Power of two [2] Counting No. of bits set [3] Set or clear bits without branching[4] Find maximum value[5] Finding least common multiple[6] Finding the greatest commom divisor[7] Finding if a number is an Armstrong number or not[8] Finding if a given number is prime number[9] Finding the number of twin […]

How to write an algorithm to find if a number is palindrome or not
#include <stdio.h> palindrome() { int n, reverse = 0, temp; printf(“Enter a number to check if it is a palindrome or not: “); scanf(“%d”,&n); temp = n; while ( temp != 0 ) { reverse = reverse * 10; reverse = reverse + temp % 10; temp = temp/10; } if ( n == reverse […]

How to write an algorithm to detect if two integers have opposite signs ?
/* detect if two integers have opposite signs */ #include <stdio.h> int x , y; typedef int bool; bool f; int sdetect(x , y) { f = ((x ^ y) < 0); if ( f == 1 ) { printf(“They have opposite signs\n”); } else { printf(“They have same signs\n”); } }

Burrowsâ€“Wheeler Transform . 1994
commandline session $cat hello Hello. How are you $../bwt hello $ls hello hello~ hello.bwt $rm hello~ $ls hello hello.bwt $cat hello.bwt u.weo rHellyHaoo $ $hexdump hello.bwt 0000000 750a 772e 6f100 200a 4872 6c100 796c 6148 0000010 6f6f 0520 0000 0000 0000017 $../unbwt hello.bwt $ls hello hello.bwt hello.bwt.y $cat hello.bwt.y Hello. How are you $