Giter Club home page Giter Club logo

big_o_analysis's Introduction

Big O Analysis Practice

This repo contains some example files to practice determining big O time and space complexity.

It also contains a few visualizations.

I would suggest looking at the examples in random order.

Scroll down to the bottom of each example to see the answers.


In order to run the visualizations, you need matplotlib.

Your setup may differ. Here's how I do it:

In terminal:

pipenv install
pipenv shell
pip install matplotlib

I would love to add more examples. This is just a start.

Please send me a pull request if you have more examples to add. Thank you!


A little about what Big O is:

As far as time complexity goes:

"Big O notation is the language we use to describe the complexity of an algorithm. In other words, Big O notation is the language we use for talking about how long an algorithm takes to run. It is how we compare the efficiency of different approaches to a problem. With Big O notation we express the runtime in terms of how quickly it grows relative to the input, as the input gets larger."

from https://medium.com/karuna-sehgal/a-simplified-explanation-of-the-big-o-notation-82523585e835#:~:text=In%20other%20words%2C%20Big%20O,as%20the%20input%20gets%20larger%20.

With Big O, we talk about the worst-case scenerios.

As far as space complexity goes:

Similar to time, except that we look at memory (or space cost). We look at which additional memory is needed (besides what is needed for the inputs) as the input gets larger.

Big O Cheatsheet:

https://www.bigocheatsheet.com/

big_o_analysis's People

Contributors

ethyl2 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.