Giter VIP home page Giter VIP logo

algorithms1's Introduction

bigO

bigO

Comparing element vs number of operations bigO Above example is O(n) - aka Linear Time

bigO Above example is O(1) - aka Constant Time

bigO O(3) is still Constant time. It's still denotated as O(1) using bigO notation

Big O Rules to Simplify calculation:

1. Worst Case

Assume we have to perform every operation (the objective happens at the end)

2. Remove Constants

Drop the constants from the Big O calculation. Because as n gets larger, the constants become relatively less significant.

3. Different Terms for Inputs

For example, if there are 2 inputs, each used in different for loops, we need to use two terms. i.e. O(a + b)

4. Drop non-Dominants

For example, if the total complexity is O(n + n^2), then drop the O(n) for just O(n^2) because O(n) will become relatively less important as n increases

Interesting note:

  • O(1) - no loops
  • O(log(n)) - searching when the items are sorted
  • O(n) - single loop
  • O(n*log(n)) - sorting
  • O(n^2) - nested loops
  • O(2^n) is common when doing recurrsion
  • O(n!) is when a loop is bing added for every element

Overview

Data Structures

  • Arrays
  • Linked Lists
  • Stacks
  • Queues
  • Trees
  • Tries
  • Graphs
  • Hash Tables

Algorithms

  • Sorting
  • Searching
  • Recurrsion
  • Dynamic Programming

Operations on Data Structures

  • Access
  • Searching
  • Insertion
  • Deletion
  • Traversal (Access each point exactly once for processing)
  • Sorting

There are tradeoffs between different data structures and algorithms:

  • Readability
  • Space Complexity
  • Time Complexity

operations

algorithms1's People

Contributors

maxitron93 avatar

Stargazers

 avatar

Watchers

 avatar  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.