Upgrade to Pro — share decks privately, control downloads, hide ads and more …

BIG-O Notation

BIG-O Notation

Programming and program flows complexity

Hyperjump Tech

April 16, 2024
Tweet

More Decks by Hyperjump Tech

Other Decks in Programming

Transcript

  1. So, What is Big O Notation? It allows as to

    talk about how the runtime of the algorithm grows as the inputs grow.
  2. Why is important to know this? being aware of the

    efficiency of an algorithm so programmer can create applications with good performance
  3. Constant-Time O(1) + regardless of the complexity (number of items),

    the time (iterations) is constant. + no loops
  4. Other examples: + Pushing to an array + getting an

    item at a particular index + adding a child element
  5. Quadratic-Time O(N^2 ) + The time grows exponentially related to

    the number of inputs. + Nested loops of the same input
  6. Logarithmic-Time O(log n) + the most efficient approach when dealing

    with large collections + Divide-and-conquer strategy + -ideally- find a specific element in a collection of one million elements using less than 20 iterations, if we scale the size of the collection to a billion, we will require only less than 30 iterations.
  7. Discussion + Sharing pengalaman / seberapa berguna ini di real

    project lain? + Kapan udh perlu aware tentang ini? + Ada kasus nyata menarik? ada yg pernah? + Kenapa pas di interview-interview ditanya tentang hal ini, padahal kalau di FE hampir gak mungkin ada data ribuan, biasanya di BE