One big difference between CS and non-CS software engineers

cs vs non cs software engineers nickang blog post banner
Photo by Alexis Brown on Unsplash

From what I can tell so far, software engineers who didn’t graduate from a Computer Science (CS) degree program quite often have an inferiority complex.

Continue reading “One big difference between CS and non-CS software engineers”

Implementing a Queue in JavaScript?

Yesterday I asked myself whether it was necessary to implement a stack abstract data type in JavaScript. The answer turned out to be “no,” because you can just use the built-in Array data type to simulate a stack without obvious performance penalties.

Naturally, I started asking myself, what about a queue? Should we be implementing a queue in JavaScript?

Continue reading “Implementing a Queue in JavaScript?”

Why implement Stack in JavaScript when you have Array?

This is the stupidly simple question I asked myself today as I was trying to familiarise myself with data structures. Is there ever a need to implement a stack data structure in JavaScript when the built-in Array data structure already exists?

Based on my short research, the answer is no – there’s probably no need to implement a separate Stack constructor function or class in JavaScript. Since Array already has the typical methods you’d need for a stack to work, like push() and pop(), you can just use an array to simulate a stack.

Continue reading “Why implement Stack in JavaScript when you have Array?”

Bubble sort explained

bubble sort explained banner
Photo by Sime Basioli on Unsplash

The goal of bubble sort is to sort an array in ascending or descending order according to a sortable property.

In our example below, we just use an array of integers to directly simulate the sortable property (a number), but in reality, you can imagine that that probably isn’t a frequent use case. What’s probably more common is sorting an array of objects by one of their properties, like IDs.

Continue reading “Bubble sort explained”

Why use Binary Search Tree?

why use binary search tree banner with peace hand sign
Photo by Nathan Fertig on Unsplash

If you already know what a binary search tree is for and how it works, read on to learn about their main strengths and weaknesses in this post! Otherwise, feel free to take a moment to read part 1 for an introduction.

Why is a binary search tree useful? What are some of its main weaknesses?

Let’s try and answer those questions in this post.

Continue reading “Why use Binary Search Tree?”

Binary Search Tree explained

binary search tree explained nickang blog banner
Not my arm. Photo by Patrick Fore on Unsplash

What is a binary search tree? How is it related to binary search? Is it an algorithm or a data structure?

In this post I’ll share what I’ve learned about binary search tree in the last week from videos, tutorials, and practice. As usual, the resources I used to learn about this data structure (you caught your first lesson already!) will be shared at the bottom of this post.

Without any further delay, let’s dive in!

Continue reading “Binary Search Tree explained”

Binary Search explained

binary search blog banner nickang
Photo by Pablo Garcia SaldaƱa on Unsplash

If you’re a software engineer, you’ve probably heard about binary search before. And if you don’t know what it is, how it’s implemented, and its strengths and weaknesses, this post is for you.

Binary search is, as its name suggests, a search algorithm. In fact, it’s one of the most efficient and commonly used search algorithms.

Continue reading “Binary Search explained”