Giter Club home page Giter Club logo

algo's Introduction

Hash

Czym jest hash?

  • Jest to rezultat działania funkcji hashującej.

Czym jest hash function?

  • funkcja hashująca pozwala na przełożenie inputu na output
  • poprawna funkcja hashująca zwraca te same wartości przy tych samych danych wejściowych

Czym jest hash table?

  • Jest to struktura danych powstała poprzez zastosowanie funkcji hashującej, oparta na kluczu i wartości.

Stacks and Queues

  • this data structures handle temporary data well
  • they are more about elegant code than about performance

Stacks

  • This is basically an array with this constrains:

    • data are written at the and of the array
    • data are read from the last element of the array
    • data can be deleted from the end of the stack
  • common analogy: dishes

  • "top" is refering to the end of the stack

  • "bottom" is refering to the beggining of the stack

  • "pushing onto the stack" -> add a new element to the stack

  • "popping from the stack" -> delete an element from the stack

  • LIFO -> Last In, First Out

  • Example of implementation: simple linter, that checks correctness of brackets

Queues

  • Similar to Stacks, but with FIFO idea -> First In, First Out

  • An analogy to a line of people waiting for the theatre

  • Horizontal analogy: beggining of the queue is front and end of the queus is back

  • Three constraints

    • Data can be inserted to the back of the queue (similar to stack)
    • Data can be deleted from the front of the queue
    • Data can be read from the front of the queue
  • Inserting element to the queue is called enqueue

  • Removing element from the queue is called dequeuing

Recursion

  • It is a function that is calling itself. Recursion have base case that prevent it from infinite loop.
  • It works based on stack (LIFO). The whole process of recursion is called call stack. It is because before completed stack, it calls functions n times.

Where it shines?

  • When you have problem with undefined level of depth

Where it is used?

  • to repeatedly execute a task
  • performing a calculation based on a subproblem

Two recursion strategies:

  • Bottom-up
  • Top-down

algo's People

Contributors

hermeneuta avatar

Watchers

 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.