Saved

Press the star next to a tool's name to save it.

All my tools

Computer Science Formula Sheet

This computer science formula sheet collects the formulas used in algorithms, number systems, Boolean logic and performance: Big O growth, powers of two, De Morgan's laws and Amdahl's law. Search, filter and print.

Restored your last values ·

Your search stays in your browser. Nothing is uploaded.

Formulas

–

No formulas match that search.

Recent results

This computer science formula sheet brings together the relationships you reach for when you analyse an algorithm, convert between number systems or simplify a logic expression. It lists the common orders of growth, the maths of bits and bytes, Boolean laws and a few performance formulas, each with a plain-language note.

How to use the computer science formula sheet

  1. Type in the search box to filter by any word in a name, a formula or its note.
  2. Choose a topic to see one group instead of the whole list.
  3. Read the formula in the right-hand column and its meaning on the left.
  4. Press Print for a clean copy of whatever is shown.

What is in each topic

The computer science formula sheet is split into 4 topics. The table shows how many entries each topic holds and which ones they are, so you can jump straight to the right group with the topic box.

TopicEntriesWhat it covers
Big O growth7constant; logarithmic; linear; linearithmic; quadratic; exponential; factorial
Binary and data7values from n bits; largest unsigned value; two's complement range; bits needed; bytes; hex digit; binary to decimal
Boolean logic6and; or; not; de morgan's law 1; de morgan's law 2; xor
Performance and networks5speedup; amdahl's law; throughput; transfer time; recurrence for divide and conquer

Big O and orders of growth

Big O notation describes how the work an algorithm does grows with the input size n. Common classes, from slowest to fastest growing, are O(1) constant, O(log n) logarithmic, O(n) linear, O(n log n) linearithmic, O(n²) quadratic, O(2ⁿ) exponential and O(n!) factorial. [1] Binary search halves the problem at each step and so runs in O(log n), while a double loop over the same list is typically O(n²).

Big O describes growth, not exact speed. It ignores constant factors, so an O(n) method with a heavy step can lose to an O(n log n) method on small inputs. Use the sheet to place an algorithm in a class, then measure if the difference matters.

Binary, bits and bytes

A group of n bits can hold 2ⁿ different patterns, so the largest unsigned whole number is 2ⁿ − 1. For example, eight bits give 256 patterns and a maximum of 255. To find how many bits you need for N different values, take the base-2 logarithm and round up.

One byte is eight bits and one hexadecimal digit is four bits, so two hex digits make one byte. To convert a binary number to decimal, add the powers of two where the bit is 1. These are standard definitions and are listed as our own working.

Boolean logic and performance

De Morgan's laws let you push a negation inside a bracket: the negation of A AND B equals NOT A OR NOT B, and the negation of A OR B equals NOT A AND NOT B. [3] They are used constantly to simplify conditions in code and logic circuits.

Amdahl's law gives the overall speedup when only part of a task is improved: S = 1 ÷ ((1 − p) + p ÷ s), where p is the share of the work that benefits and s is the speedup of that share. [2] If half the work becomes ten times faster, the whole task speeds up by less than two times. The sheet also lists the simple speedup ratio, throughput and transfer time, where you must convert bytes to bits before dividing by a bit rate.

Who this page helps

Students use a formula sheet to check a relationship while they practise problems, to build a revision page and to remember what each symbol stands for. Teachers can print a topic for a class handout, and anyone returning to the subject after a break can see the standard forms at a glance.

Tips for getting the most from the computer science formula sheet

  • When you compare algorithms, drop constants and lower-order terms and keep only the fastest growing term.
  • Convert between bits, bytes and hexadecimal in small steps, writing the intermediate result at each stage.
  • Draw a truth table to confirm a Boolean simplification before you rely on it in code.

Common mistakes

Most wrong answers come from using a formula outside the conditions it was written for, from mixing units, or from reading a symbol as something else. Check what each letter stands for before you substitute numbers, keep units consistent from start to finish, and estimate the size of the answer so an obviously wrong result stands out.

Where the entries come from

Each entry was checked against the sources listed below this article. Where a formula is a standard textbook definition that the sources do not state in that form, the article says it is our own working. Notation varies between textbooks, so if your course writes a formula differently, follow your course.

What this page does not do

It is a reference, not a calculator, so it will not work out numbers for you and it does not replace a worked example from your teacher. For calculations, use the linked calculators and compare their answers with your own working.

Printing and checking

Filter by topic before you print if you only need one section, and the printed page will be shorter. The notes are short on purpose, so keep your textbook or the official documentation open for the full detail and for anything that changes between versions.

What next

Use this often? Add Computer Sci to your Home screen.

Frequently asked questions

What does this computer science formula sheet cover?

Big O growth classes, bits and binary maths, Boolean logic laws, and performance formulas such as speedup, throughput and Amdahl's law.

Is O(n log n) faster than O(n squared)?

For large inputs yes, because n log n grows far more slowly than n squared. For tiny inputs constant factors can reverse the order.

How many values can n bits store?

Exactly 2 to the power n patterns. As unsigned whole numbers they run from 0 to 2 to the power n minus 1.

Why use De Morgan's laws?

They rewrite a negated AND as an OR of negations and a negated OR as an AND of negations, which often makes conditions simpler to read.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Education Tools