ƒ(m)(o)(b)(b).dev

      

Thanks for passing by!
This blog is something like my personal library for interesting articles related to web development. Also I'll give my best to write on some interesting topic once a week, so bear with me.
If you wanna know more about me take a look at my social media profiles.
And if you have opportunities for me, or just want to say Hi! contact me :)
Cheers!

Featured picks

Developers are Artists

FEATURED

Developers are Artists

Thoughts on why many companies that offer coding as a service are failing to achieve something significant and even run out of business.

Let's filter!

By provider:

Search!

Anti-patterns You Should Avoid in Your Code

Anti-patterns You Should Avoid in Your Code

Published in: freeCodeCamp.org

Every developer wants to write structured, simply planned, and nicely commented code. There are even a myriad of design patterns that give us clear rules to follow, and a framework to keep in mind. But we can still find anti-patterns in software that was written some time go, or was

JavaScript Algorithms: Merge Sort

JavaScript Algorithms: Merge Sort

Merge sort is a sorting algorithm that uses the “divide and conquer” concept. Given an array, we first divide it in the middle and we get 2 arrays. We recursively perform this operation, until we get to arrays of 1 element. Then we start building up the sorted array from scratch, by ordering the individual items we got. Suppose our array is this: [4, 3, 1, 2] We first divide the array into 2 arrays:

JavaScript Algorithms: Quicksort

JavaScript Algorithms: Quicksort

Quicksort is a more efficient searching algorithm than selection sort, in most cases, and it makes use of recursion. Recursion means we call a function from within the same function. It’s a very useful practice, sometimes, and this is one of those cases. I said “in most cases”, because as we’ll see, in the worst case bubble sort can take the same time of selection sort: O(n^2). But in the best case scenario, it will run at O(n log n), which is in the middle between O(n) and O(n^2).

JavaScript Algorithms: Selection Sort

JavaScript Algorithms: Selection Sort

Suppose we have an array of numbers, and we want to sort it by element size. You could have an array of objects, and you could compare an object property, like sorting by age, or alphabetically by last name. The details don’t change. We work in this way: we pick the first item. Then we compare it with the second item. If the second item is smaller, we swap it with the first.

JavaScript Algorithms: Binary Search

JavaScript Algorithms: Binary Search

Binary search assumes the array (or any other data structure) you are searching in is ordered. We start with the array, and the item we need to search for. We look at the middle of the array. We take the number of elements, and we divide it by 2. Imagine we have a part of the array on the left, and the other part on the right. If the item we have is lower than the one we’re looking for, then it must be in the right part, so we can completely discard the part on the right.

JavaScript Algorithms: Linear Search

JavaScript Algorithms: Linear Search

Linear search, also called sequential or simple, is the most basic search algorithm. Given a data structure, for example an array, we search for an item by looking at all the elements, until we find it. Its implementation is very simple: const linearSearch = (list, item) => { for (const [i, element] of list.entries()) { if (element === item) { return i } } } This returns the index of the item we’re looking for.

Powered by