Ajax-loader-large-white
Big O
Binary

In this section we are going to start by practicing the ability to identify Big O efficiencies of algorithms and functions you began to develop in the previous section.

Here we have a function that returns an array of all binary strings of length n. Because each digit of the string can be either 1 or 0, the number of strings grows very quickly with respect to the size of the strings.

Instructions

Print the Big O of this function to the console. It will be a function of the size of the strings produced, n. Use the caret, "^", to denote exponents. For example O(n^2) is quadratic ("n squared").

?
Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

Each digit of the string can be one of two possibilities: either 1 or 0. There are n digits in each string. This means that to find the total number strings (which is equal to the total amount of work done), just multiply n 2's together. The Big O describes this amount of work.

script.js