User Tools

Site Tools

This is an old revision of the document!

Binary to decimal

A simple algorithm to convert a binary string to a decimal number in $O(n)$ time. For each character in the string the result is multiplied by $2$ and if the character is a '1' then $1$ is added to the result.

λ binary_to_decimal

binary_to_decimal.1363579291.txt.gz · Last modified: 2015/02/02 08:24 (external edit)