WT

Array Sorting Algorithms, Part 2: Radix Sort

This is part 2 of a series of posts going into different array sorting algorithms. I will be looking at radix sort in this one. Check out my pal Marq’s blog for other sorting algorithms. Here is part 1 of my blog if you missed it.

Read More

Implementing Skip Lists

Skip lists are interesting data structures that rely on a random element in its design. The resulting data structure allows O(log(n)) time complexity for search, insert, and delete operations with high probability. Here is a walkthrough of a skip list implementation, also available on my Github repo.

Read More

Array Sorting Algorithms, Part 1: Mergesort

This is part 1 of a series of posts going into different array sorting algorithms. I will be looking at mergesort in this one. Check out Marq’s blog for other sorting algorithms, as we’ll be looking at different ones during this “sprint”.

Mergesort is a divide-and-conquer array sorting algorithm that can be implemented in several ways. Conceptually, the algorithm goes like this:

  1. Split the list of n elements into n sublists with 1 element each
  2. Repeatedly merge sublists into sorted lists until only 1 list remains
Read More

MongoDB Connection Pooling with Node.js Modules

How to implement MongoClient connection pooling in a simple Node.js/MongoDB web app.

Read More

Saving Bcrypt Hashed Passwords to Database with Bookshelf.js

The slow-by-design processing time is a strength of the bcrypt hashing algorithm, but it also means that it needs to be performed asynchronously so as not to block. I ran into some issues when trying to save hashed passwords into the databse using the Bookshelf.js ORM - here is how I resolved them.

Read More

MongoDB Setup - Data Directory Not Found or Permission Denied

Fixing error messages that I got when setting up MongoDB.

Read More

JavaScript Class Instantiation & Inheritance Patterns

At first glance, JavaScript may not seem like an object oriented programming (OOP) language, but it does have powerful object oriented programming capabilities. OOP features such as inheritance, polymorphism, and encapsulation are all enabled in JavaScript. However, being a very flexible language, there are several different ways to define classes and use them. Here’s an overview of all the different JavaScript class instantiation and inheritance patterns and how to implement them.

Read More

Constructing a Hash Table

The beauty of hash tables is obscured in languages such as JavaScript that have built-in data structures for storing key-value pairs. In some languages, hash tables need to be constructed manually using primitive arrays. Aside from the ability to store associative data, hash tables have many performance advantages over other data structures. For example, the value of a key can be retrieved at constant time, independent of how many key-value pairs are in the hash table. Learning about how hash tables work is important, so here is an overview of the inner workings of hash tables.

Read More