Hay un curso de BigO muy bueno
Introducci贸n al Clean Code
Deuda t茅cnica y refactorizaci贸n de c贸digo
Reglas del dise帽o simple
Qu茅 es Clean Code
Nombre y uso de las variables
Uso correcto de var, let y const
Reglas para la nomenclatura
C贸mo nombrar seg煤n el tipo de dato
Ejercicio: Nombra correctamente seg煤n su tipo de dato
脕mbito de las variables
脕mbito global
脕mbito local o de funci贸n
脕mbito de bloque
脕mbito est谩tico
Hoisting
Funciones
Declaraci贸n y expresi贸n de funciones
Par谩metros y argumentos
Funciones de flecha y el this
Clases
POO con ES6 (constructores, m茅todos y herencia)
Herencia en JavaScript
Tama帽o reducido (responsabilidad 煤nica)
Organizaci贸n
Optimizaciones
Cu谩ndo usar comentarios
Formato coherente (codear en equipos)
Principio DRY
Notaci贸n big O
Cierre
Sigue aprendiendo JavaScript
Contributions 5
Questions 0
Hay un curso de BigO muy bueno
Otros algoritmos de b煤squeda muy famosos que usan O(n log n) son los binarios. Cualquier algoritmo binario tiene esta notaci贸n, lo cual la hace muy eficiente, pero para que esto funcione, la data necesita estar ordenada.
O(1)
<const getLast = items => items[items.length-1];
console.log(getLast(['a', 'b', 'c', 'd'])); //> d(1 iteraci贸n)
console.log(getLast(['a', 'b', 'c', 'd', 'e', 'f', 'g'])); //> g(1 iteraci贸n)>
O(N)
<const findIndex = (items, match) => {
for (let i = 0, total = items.length; i < total; i++)
if (items[i] == match)
return i;
return -1;
};
const array= ['a', 'b', 'c', 'd'];
console.log(findIndex(array, 'a')); // 0 (1 iteraci贸n)
console.log(findIndex(array, 'd')); // 3 (4 iteraciones)
console.log(findIndex(array, 'e')); // -1 (4 iteraciones)>
O(N虏)
<const buildSquareMatrix = items => {
let matrix = [];
for (let i = 0, total = items.length; i < total; i++){
matrix[i] = [];
for (let j = 0, total = items.length; j < total; j++)
matrix[i].push(items[j]);
}
return matrix;
};
console.log(buildSquareMatrix(['a', 'b', 'c']));
/* 9 iteraciones para 3 elementos, retorna:
[
['a', 'b', 'c'],
['a', 'b', 'c'],
['a', 'b', 'c']
]
*/ >
O(n log n)
<const quickSort = list => {
if (list.length < 2)
return list;
let pivot = list[0];
let left = [];
let right = [];
for (let i = 1, total = list.length; i < total; i++){
if (list[i] < pivot)
left.push(list[i]);
else
right.push(list[i]);
}
return [
...quickSort(left),
pivot,
...quickSort(right)
];
};
console.log(quickSort( ['q','a','z','w','s','x','e','d','c','r']));
// ["a", "c", "d", "e", "q", "r", "s", "w", "x", "z"]>
Want to see more contributions, questions and answers from the community?