Skip to content

Instantly share code, notes, and snippets.

@eengineergz
Created February 27, 2021 04:48
Show Gist options
  • Save eengineergz/5dec7e3736d7b5e28a5f1c85b5b50705 to your computer and use it in GitHub Desktop.
Save eengineergz/5dec7e3736d7b5e28a5f1c85b5b50705 to your computer and use it in GitHub Desktop.
// O(2^n)
function exponential2n(n) {
if (n === 1) return;
exponential_2n(n - 1);
exponential_2n(n - 1);
}
// O(3^n)
function exponential3n(n) {
if (n === 0) return;
exponential_3n(n - 1);
exponential_3n(n - 1);
exponential_3n(n - 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment