This is part 3 of Big O for Noobs, if you’d like to read part 1, you can do so here and part 2 over here.

By now, it should be pretty clear that when iterating through a string or an array in search for something, the time complexity is O(n). O(n) is not bad, you can do worse than O(n), like O(n²). How do you get O(n²) you ask? Even if you didn’t ask, I’ll tell you. You most likely came up with a solution with a nested loop. If you find yourself coming up with a solution containing…

This is part 2 of Big O for Noobs, if you’d like to read part 1, you can do so here.

In the last post, we concluded that the time complexity for the operations performed on an array were:

Read — O(1)
Insertion — O(n) — worst case, O(1) — best case if inserted at the end
Search — O(n)
Deletion — O(n) — worst case, O(1) — best case if deleted from the end

When we apply the same logic to hashes, we will get:

Read — O(1)
Insertion — O(1)
Search — O(n)
Deletion — O (1)

Let me preface this post with…I’m still working on my problem solving skills and am improving how I code by trying to identify the time complexity of my code as I code.. And as the saying goes, the best way to learn is to teach, so stumble along with me as I work all this out in my head.

When first introduced to Big O, my brain went blank from simply trying to understand the definition. If you’re here, it probably happened to you too, but don’t fret, I’m hoping that you’ll have a clearer picture after reading this.
You’ve probably…

Greetings, fellow coders. Up to this point, every time I start building a new app, I usually(always) stumble around when it comes to setting up the authentication part. Since I’m building a new app now and authentication is what I tend to work on first, let me guide you through my process of setting up the authentication on my Rails API with devise and devise_auth_token.

First thing, let’s create your Rails app with the command:

rails new app_name — api

If you’ve already created an app without the — api flag, you can change it to an API app by…

Every time I get a new PC or re-install Windows I had to do some digging to set up my development environment all over again, but this time I figured I’d document all the steps into this nifty little copy&paste cheatsheet.

Install Windows Subsystem for Linux

1) Go to “Turn Windows features on or off” by either clicking the Windows button and start typing “features”, or go to Control Panel > Programs > Turn Windows features on or off

2) Check the box for “Windows Subsystem for Linux”

3) Restart Windows after installation

4) Download Terminal from the Microsoft App…

Jonathan Luk

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