Slide 1

Slide 1 text

Big O Notation A simple explanation

Slide 2

Slide 2 text

Algorithm Efficiency + Time Complexity + Space Complexity

Slide 3

Slide 3 text

Time complexity describes the amount of computer time it takes to run a function

Slide 4

Slide 4 text

So, What is Big O Notation? It allows as to talk about how the runtime of the algorithm grows as the inputs grow.

Slide 5

Slide 5 text

Why is important to know this? being aware of the efficiency of an algorithm so programmer can create applications with good performance

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Constant-Time O(1) + regardless of the complexity (number of items), the time (iterations) is constant. + no loops

Slide 8

Slide 8 text

Other examples: + Pushing to an array + getting an item at a particular index + adding a child element

Slide 9

Slide 9 text

Linear-Time O(N) Worst case time (iterations) grows on par with the number of items.

Slide 10

Slide 10 text

Other examples:

Slide 11

Slide 11 text

Quadratic-Time O(N^2 ) + The time grows exponentially related to the number of inputs. + Nested loops of the same input

Slide 12

Slide 12 text

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.

Slide 13

Slide 13 text

Exponential Time O(2^n) + double the number of operations performed relative to the input size.

Slide 14

Slide 14 text

Factorial Time O(n!) + the most expensive one. Adding a nested loop for every elements.

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Real World Problem

Slide 17

Slide 17 text

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