# Asymptotics Practice

Make sure to review Asymptotic Analysis Basics before proceeding with these problems.

## Introduction

Asymptotics is a very intuition-based concept that often doesn't have a set algorithm for computing. The best way to get good at analyzing programs is to practice!

With that said, here are some problems of increasing difficulty for you to enjoy 😊

For all of the below problems, assume that all undefined functions have a constant O(1) complexity.

## Loops

What runtime does this function have?

What runtime does this function have?

I've tweaked the previous problem a little 😁 Try to spot the difference and see if it changes the runtime at all!

## Recursion

The following two problems are inspired by this worksheet.

TREEEEEEEEE recursion 🌳🌲🌴

Let's replace the 4 in the previous problem with **n** and see what insanity ensues.

## Best and Worst Case Runtimes

Here's a case where the best case and worst case runtimes are different. Can you figure out what they are? (Let `n = items.length`

).

Here's a mutual recursion problem! What are the best and worst cases for `explodeTNT(n)`

? What are their runtimes?

## Challenge Problems

These problems are quite difficult. Don't be concerned if you don't feel confident in solving them (I certainly don't).

A huge disaster :ooo

Congrats for making it this far! By now you should be an expert in asymptotic analysis :P Here's one last problem:

Last updated