Big O Notation

Big O gives us a standardized why to evaluate the efficiency of an algorithm via its run time and space time complexity. Run time complexity is how many iterations an algorithm takes to solve a problem and space time is how much memory is needed. In modern computing, space is less of a concern so most algorithms look to optimize run time complexity.

When determining the Big O of an algorithm we state it as an approximation and we always focus on the worst case scenario. The following graph denotes the most common Big O types.


React Form Validation

Live Demo: https://react-form-validation.verdi327.now.sh

Form validation can be a pain in the butt. What seems like a relatively straightforward tasks can actually have many moving parts. This article outlines a simple and effective approach which will give your users feedback as they type (not before!) and allow you full control over what validations you want to include and what types of error messages you want to show.

Overview

  1. Make every input a controlled input — i.e. its value should be set within the component’s state.
  2. Add onChange handlers to all the form fields. …


React Logo

One of the killer features of React is its ability to quickly discern what pieces of data have changed and to only update the affected UI components. Previously, developers resorted to wholesale UI updates based on state changes. React’s starting point for making these changes is through its setState() function.

React will make a copy of your state object and then compare it to a previous snapshot. If there are differences, React will re-render the component. …


Treat other developers how you want to be treated

Standards Exist, Use Them!

Much of the internet is the wild west. There are no hard and fast rules that you have to abide by when building a new web application. However, just because you can build an application in whatever manner you want doesn’t mean you should. The web has standards — which at their core are a set of best practices — that allow for productivity and ease of use because consumers of your application can expect it to operate in a certain manner.

Imagine you’re a web browser. You’re requesting information from a server. You expect the html, stylesheets and javascript…


Bitcoin is a digital currency that is built on a blockchain. Bitcoin, and others, are often referred to as cryptocurrencies because they take advantage of cryptographic algorithms to ensure the integrity of their transactions.

Cryptographic digital currencies represent the next evolution of money because they are easy to store, receive and send while being more secure and less vulnerable to manipulation than modern fiat currencies.

In this article, I’ll explain what Bitcoin is and how it utilizes both cryptography and the blockchain to work. This article will include an overview of various technical details, which can at times be confusing…


Recursion is great. It allows us to write a bit of logic and then have that logic repeatedly executed on a smaller and smaller data set until our base case is hit. In this way, we can write code that is succinct and elegant.

A Recursive Case

Take the famous Fibonacci sequence for example which works by taking the sum of the previous two numbers in a sequence to determine the next number.

1-1-2-3-5-8-13-21-34-55-89 etc...

Using recursion, we can write a simple solution.

function fib(num){
if (num <= 2) return 1
return fib(num-1) + fib(num-2)
}

This makes perfect sense because of the…


In a previous article, I explained the basics of the graph data structure. I mentioned that understanding how to model and traverse a graph is very important because of its many applications throughout the web. In this article, we’ll explore Dijkstra’s Algorithm — which is an algorithm that maps the shortest path between two nodes on a graph.

The Problem

Suppose you have the following graph structure and you want to know the fastest route between nodes A and E. How would you go about determining it?

Weighted Graph Diagram

Because there are only six nodes on this graph it is pretty easy to quickly…


In previous articles I’ve explored various different data structures — from linked lists and trees to hash tables. In this article I’ll explore the basics of working with a graph data structure.

To begin, let’s define the graph data structure. Graphs are collections of data points — called nodes or vertices — which connect to each other. How each node connects to another is where the value in graph data lies, which makes graphs great for displaying how one item is associated with another.

The image below is an example of a basic graph.

Diagram of a Simple Graph

Graphs are used to model data…


Hash tables utilize key-value pairs to store data. Because of their speed and utility almost every programming language ships with some type of hash table implementation. Hash tables in Javascript are called Objects, in Python its Dictionaries and in Java, Go and Scala its Maps. Hash tables came to exist because humans think in more than just numbers.

Arrays are great, but having to model all of your data based off indices is a nightmare. So, hash tables exist because being able to model your data like this passwords["gmail"] is way better than having to model it like this passwords[0].


In my last article I outlined the tree data structure, how to implement a binary search tree and an overview of various ways to traverse every node in a binary search tree. You can see that article here: https://medium.com/@verdi/working-with-trees-2083739b8918

In this article, I’ll continue to explore different variants of the tree data structure. Recall that binary trees are one of many subtypes of trees. Another subtype are heaps. Heaps are very similar to binary search trees but differ in two important ways.

  1. In a heap, the parent node must always be greater the child nodes (if building a max heap)…

Michael Verdi

eat more plants

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