Computation FAQ

Common questions about binary, boolean logic, Big-O, and character encoding. Each answer is short. Links go to the full explanation.

What is the difference between a bit and a byte?

A bit is a single 0 or 1 — the smallest unit of information. A byte is 8 bits, giving 256 possible values (0-255). A byte is the smallest addressable unit of memory.

Memory sizes are measured in bytes: 1 KB = 1,024 bytes, 1 MB = 1,024 KB, 1 GB = 1,024 MB.

See How Binary Works for the full breakdown of bits, bytes, and number representation.

Why is 0.1 + 0.2 not 0.3?

Floating point represents numbers in binary. Just as 1/3 cannot be represented exactly in decimal (0.333...), 0.1 cannot be represented exactly in binary. The tiny rounding error accumulates: 0.1 + 0.2 = 0.30000000000000004.

This happens in every programming language. For money and exact arithmetic, use integers (store cents, not dollars) or decimal types.

See How Binary Works for the explanation of IEEE 754 floating point.

What does O(n) mean?

Big-O describes how an algorithm's time grows with input size. O(n) means linear — double the input, double the time. O(1) is constant (a hash map lookup). O(log n) is logarithmic (binary search). O(n²) is quadratic (nested loops).

The notation ignores constants and focuses on the growth shape. At scale, O(n log n) always beats O(n²).

See How Complexity Works for the full comparison table and real-world examples.

What is the difference between ASCII and UTF-8?

ASCII maps 128 characters (English letters, digits, punctuation) to 7 bits. UTF-8 encodes all 150,000+ Unicode characters (every writing system, every emoji) in 1-4 bytes.

The key: ASCII text is valid UTF-8 with no conversion needed. UTF-8 is backward compatible, which is why it became the dominant encoding (98% of websites).

See How Character Encoding Works for the full evolution from ASCII to Unicode to UTF-8.

What is two's complement?

Two's complement is how computers represent negative integers. The highest bit is the sign bit (0 = positive, 1 = negative). To negate: flip all bits and add 1. With 8 bits: range is -128 to 127.

The elegant property: the CPU uses the same addition circuit for signed and unsigned numbers. No separate hardware needed.

See How Binary Works for worked examples of two's complement arithmetic.

Why does hexadecimal exist?

Hexadecimal (base-16) is a compact way to write binary. Each hex digit represents exactly 4 bits. One byte = two hex digits. 0xFF = 11111111 = 255.

Used in memory addresses, color codes (#FF0000 = red), MAC addresses, and binary dumps. Easier to read than binary, directly translatable.

See How Binary Works for the hex-to-binary conversion table.