loading...

Adventures With Algorithms

heyjtk profile image JTK ・4 min read

Background On Why I'm Doing This

About a week ago I made a decision to finally do it: to FINALLY deep dive on algorithms and learn them properly.

Algorithms have always been an area of insecurity for me. No particular reason. They don't come up that often in day to day life and I felt more pressure earlier in my career to use my free time to build a portfolio in the technologies I wanted to work with than "memorize minutia" => (that was actually what I thought it was.)

I guess my thinking has changed over time. I now work with databases and ETL systems (extract-transform-load) where an inferior algorithm can literally make it take hours longer to run than a superior algorithm. I think working with ETL systems is what finally made me feel interested in learning algorithms in earnest instead of just, I don't know, obligated. I have already experienced fine tuning algorithms for an ETL system that have cut down its runtime by hours and it was actually pretty fun, like a puzzle.

It's also not lost on me that there are algorithmic underpinnings to everything I do. Database operations use a series of different algorithms depending on what you're looking for. If I use the built-in sort function in python, I'm using timsort. If I'm using sort in javascript, depending on the values I might be using merge sort, radix sort, or quick sort.

So whether I want to be aware of them or not, algorithms are all around me. And it seems like time to pull my head out of the sand and understand them better.

So a week ago I came up with an algorithm study plan. I also started an algorithm study group in a slack community I'm on for accountability (recommend this! Its so supportive, makes it more fun).

My Study Plan

My study plan is slightly random, and that was intentional. I want exposure to different things & to be well rounded. I also anticipated that I might like some sources more than others and wanted to give myself variety for that reason. Here's what I came up with:

Sunday

  • One hour of videos, I started with some Treehouse content on algorithms covering Big 0 and sorts
  • One SQL problem on Leetcode (I hadn't leetcoded for a while, so I let myself start on "easy" this week. Maybe that's embarrassing, I don't care. Last time I leetcoded it was hard for me so I wanted to start where I had traction and go from there. I'm pleased to report the easy were too easy so next week I'm on to medium)

Monday

Tuesday

  • One hour of Interview Cake (also highly recommended, but haven't used it before. One week in, I like it so far!)

Wednesday

  • One leetcode problem (traditional programming, so for me that means python)

Thursday

  • One leetcode SQL problem

Friday

  • Nothing! Taking a break. I think an important part of sticking to goals is making them realistic. Knowing myself, I'm not doing anything on Friday lol

Saturday

  • One hour of videos (Treehouse again for me this week...when I run out of those I'll cycle onto other things)
  • One traditional programming leetcode problem

Looking Back After One Week

I was so thrilled/surprised at how EASY this week was. I had one slip on Monday when a work emergency kept me from doing The Imposters Handbook. Everything else I stuck to.

Even though since the last time I tried doing much leetcoding (2 years ago) I haven't done any dedicated algorithm practice, coming back to it this time was a totally different experience. I'm not alone in that. Someone in the slack group I started said that they were influenced to try algorithms again by what I was doing and they were amazed how much easier it was for them this time.

That part still kind of blows my mind. How am I better? I wasn't practicing at all between the last time I was trying to leetcode regularly and now. I can't really explain it, but it's a welcome change. If I had to guess probably just a mix of letting these ideas simmer, and the amount I've grown as a programmer in the past two years.

When I say easy are too easy, too easy as in I can write the solution without even editing it after hitting "run" in some cases. In other cases I can come up with a solution in 5-20 minutes. That is night and day from how long it used to take me. My only takeaway from that is that if algorithms are hard for you, do keep trying because it seems like the struggle culminates in this magical understanding at a certain point and it's a great feeling.

Moving On

Because of the success of this intro week, I'm moving on to medium difficulty problems next week.

I'm keeping a repo of all my leetcode problems and notes about their performance and what the correct answer was if I don't come up with the most efficient method.

After these introductory Treehouse videos, I'm also going to try to center my video consumption around a certain theme per week, like a certain data structure or sort algorithm.

Overall I'm really liking the experience. If you have algorithm learning resources you've liked I'd also love to hear about them in the comments.

Posted on by:

heyjtk profile

JTK

@heyjtk

She/her. Multithreaded wonder. Snark pinata. Come for the code, stay for the sass. Dev Lead, and head over heels in love with Python, SQL, and JavaScript.

Discussion

markdown guide