Giter Site home page Giter Site logo

algorithms's Introduction

Algorithms

An algorithm is a step by step method of solving a problem. It is commonly used for data processing, calculation and other related computer and mathematical operations. An algorithm is also used to manipulate data in various ways, such as inserting a new data item, searching for a particular item or sorting an item.

Algoritm Comlexity

  • Space complexity: How much memory does it require?
  • Time comlexity: How much time does it require to complete?

algoritm have a set of input and output values

Algorithm classification

  • Serial/Parallel
  • Exact/approximate
  • Deterministic/non-deterministic

Some common alogorithms

  • Search algorithms
  • Sorting algorithms
  • Computational algorithms
  • Collection algorithms

Example: greatest common denominator )GCD of two integers

eg: GCD of 20 and 8 is 8 and 1 def gcd(a,b): while (b !=0): t = b b = t % b return a print(gcd(10,20))

Algorithm performance

  • Measure how an algorithm responds to dataset size

Big-O notation

  • Classifies performance as the input size grows
  • "O" indicates the order of operation: Time Scale to perform an operation
  • Many algo have more than one big O values.

Common Big-O Terms

  • O(1) Constant Time (looking up single element in array)
  • O(log n) - Lograthmic (finding an item in a sorted array with binary search)
  • O(n)- Linear time (searching in an unsorted array)
  • O (n log n)- Log-linear (Complex sorting alogs like heap and merge sort)
  • o(n^2)- Quadratic (bubble sort, selection sort)

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.