Recently I found myself in need of some open-source information. There are multiple ways to gather information on the web. You could use Selenium to scrape the web (although sites make that more difficult every year). One of the most effective ways is to use an API, and one of the best to use is Reddit's.

Reddit in itself already gathers all sorts of information from the web. The subreddits and topics are endless. It’s very much a one-stop-shop for any topic you want to research. I recently found myself in need of such information, and really appreciated Reddit's open-source…


At some point in your web development journey you’ll want full control of your website, and mastering the art of web hosting can bring you closer to that goal. If you’re reading this article I assume you’re comfortable looking at code, and using the linux terminal. I’ll be touching on the basics of setting up your apache2 server using a raspberry pi 4B model, so you should have some experience.

Side note: if you haven’t experimented with a raspberry pi I highly recommend it. They can encompass a wide range of practical projects, and teach you so much on the…


Dijkstra’s algorithm is an algorithm used to find all of the shortest distances between a start vertex and the rest of the vertices in a graph. Above you can see we start at A, and from there we will find the shortest distance to all other vertices. Dijkstra uses breadth-first search algorithm, and updates the cost of each edge updating the cost-list when it comes across an edge path that is less than what it already has.

From the start we assume every edge has a cost of infinity (this is impossible) so when it comes across the first edge…


example of depth-first-search

I wanted to discuss two types of graph search algorithms, as they are important concepts in working with graph structures.

The first is known as Depth First Search (DFS). As you can see in the gif above it travels down the vertices of a graph one by one via its connected vertex. Once it reaches the end of the branch at vertex #4 it checks back with vertex #1 to see if there was another neighboring vertex to run through.


Binary Search vs Linear Search methods

Two common search methods are linear, where we iterate through a list one-by-one till we find the value we want, or binary, where we apply a search formula/logic to more quickly find our target. There are benefits for both, and I wanted to go over them today.

When implementing a search algorithm it’s always important to consider the situation you’ll be in. Linear searches are considered better when you expect to find your target value at the beginning of a list, or if it’s a rather small list to begin with.

Binaries are better with larger data sets, and if…


Radix Sort

You ever just study something that’s made you mad? Like programming doesn’t need to be this hard, and yet you still find yourself trying to understand Radix Sort. I’d like to promise you that everything is going to be okay, but you know what, we can’t know everything, and maybe some things are just worth sitting out.

Go home. I won’t be mad.

Now for the rest of you sadist sticking around I’m going to explain Radix Sort. Am I going to explain it well? I dunno yet, but explaining things helps me learn so if you don’t find this…


example of quick sort logic

Quick-sort is another divide and conquer algorithm like the merge_sort algorithm. Quick-sort’s unique method however makes it oddly efficient, and thus popular.

It’s a recursion operation, and calls upon itself to break an array into multiple sub-list. The final sub-list will have just one element left before it breaks out of its recursion with an assorted list.

The idea is that on each level of the sub-list to grab a random element, otherwise known as the pivot, and compare it to the rest of the list, pushing smaller values to the left, and greater values to the right. Doing this…


Continuing my series on python sorting algorithms today I’m going to look at Merge Sort. Merge sort is a divide, and conquer strategy where it breaks down your list into halves repeatedly until it has just one element, and reconstructs the list in order. It even uses my favorite recursion method.


example of bubble sorting

In my next few articles I want to talk about sorting algorithms, and how they work. When working with datasets you’ll want to organize them in all sorts of ways. Here I’ll talk about bubble sorts, and their basic construction.

It’s a fairly simple concept. Bubble sort will iterate through an array, and compare pairs. If the left index is bigger then the right index the values will switch. The algorithm will then move down one index, and compare again the two values.

The complication with this is that at each iteration the algorithm is just pushing the largest value…


recursive example

Recursion are an interesting, and tricky concept in our Python tool box. Basically it’s when code goes meta, and calls upon itself to execute a self function until it meets a base requirement to exit the loop. These sorts of algorithms are used for iterating over a list.

So why use recursion when we already know loops? Recursion is simpler than an iterative-loop solution, usually because it exploits a structural aspect of the problem in a way that the iterative-loop approach cannot.

Loops will loop over controlled variables, using your typically conditional statements (if, for, while, do while) and are…

Abel Garrido

I’m a web developer, and data scientist by hobby. Yes, it can be a hobby. I blog about all things code.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store