Get flash to fully experience Pearltrees
Welcome to my computer programming algorithms directory. I am hoping to provide a comprehensive directory of web sites that detail algorithms for computer programming problems. If you know of any web sites that describe an algorithm (or multiple algorithms), please send me an e-mail . Encryption Algorithms
(A play in 4 acts. Please feel free to exit along with the stage character that best represents you. Take intermissions as you see fit. Click on the stage if you have a hard time seeing it. If you get bored, you can jump to the code .
I decided to write an article about a thing that is second nature to embedded systems programmers - low level bit hacks . Bit hacks are ingenious little programming tricks that manipulate integers in a smart and efficient manner. Instead of performing some operation (such as counting the 1 bits in an integer) by looping over individual bits, these programming nuggets do the same with one or two carefully chosen bitwise operations. To get things going I'll assume that you know what the two's complement binary representation of an integer is and also that you know all the the bitwise operations. The numbers in the article are 8 bit signed integers (though the operations work on arbitrary length signed integers) that are represented as two's complement and they are usually named 'x'.
Individually, the code snippets here are in the public domain (unless otherwise noted) — feel free to use them however you please. The aggregate collection and descriptions are © 1997-2005 Sean Eron Anderson. The code and descriptions are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY and without even the implied warranty of merchantability or fitness for a particular purpose. As of May 5, 2005, all the code has been tested thoroughly. Thousands of people have read it. Moreover, Professor Randal Bryant , the Dean of Computer Science at Carnegie Mellon University, has personally tested almost everything with his Uclid code verification system .
In the left-hand column repeatedly halve the last number, discarding any remainders, and write the result below the last in the same column, until you write a value of 1. In the right-hand column repeatedly double the last number and write the result below. stop when you add a result in the same row as where the left hand column shows 1. print ethiopian ( 17 , 34 )
Computers call these bits. A bit is either off (0) or on (1). When arranged in sets of 8 bits (1 byte) 256 values can be represented (0-255).