An algorithms is a set of instructions for accomplishing a task. Every piece of code could be called an algorithm. Grokking Algorithms - Aditya Y. Bhargava
๐ What do you find here?
<aside> ๐ก
Logarithms: log2 8 = 3 (2 x 2 x 2)
Arrays: allow to store elements next to each other - slow insertion and deletion, fast reading (random access)
Linked Lists: allow to store elements anywhere - each element stores the address to the next one - fast insertion and deletion, slow reading (sequential access)
Stack: a simple data structure, where you can push and pop items (LIFO: last in, first out)
Queues: are similar to stack with two operations: enqueue and dequeue (FIFO: first in, first out)
Call Stack: when you call function from another function, the calling function is paused in a partially completed state
Graph Model: a set of connections, is made up of nodes and edges. A node can be directly connected to many other nodes, and are called neighbours. Each connection is a edge.
Topological Sort: sort according to dependencies (graphs are like that)
Tree: is a subset of graph where no edges point back, a tree is always a graph.
Un(weighted) graph: graph with or without weight.
Set: are like list, except sets canโt have duplicates.
Set union: combine both sets.
Set intersection: find the items that show up in both set.
Set difference: subtract the item in one set from the items in the other set.
Inverted index: a hash that maps words to places where they appear.
</aside>
Big O notation is a special notation that tells you how fast an algorithm is. It measures how fast the algorithm can grow - and consider the worst-case run time.
O(c * n)
where: C is a constant and N a variable, C only matter if the algorithms are similar.