DEV Community

Thomas(Tripp) White
Thomas(Tripp) White

Posted on

A Story About Algorithms

Just like many recent Boot Camp graduates, my world has been filled with algorithms and data structures in hope to land my first professional software engineering position. I have spent countless hours on Leetcode and many other online learning sites trying to learn and master algorithms and data structures. I’m sure many people can relate that learning this subject for the first time can be quite challenging. This last week I recently had an epiphany that really helped all my hard work sink in. I wanted to share this story to hopefully help other recent Boot Camp graduates get over that learning curve of algorithms and data structures and get that first job.

What is an algorithm?

This is something I ask myself over and over when studying for my technical interviews. The definition of an algorithm is a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer. Well that makes a lot of since right? Yeah, it didn’t click right away for me either. When practicing algorithms, I was constantly thinking about this in the form of code. How can I get my code to solve a problem the best? I was looking up common patterns and was practicing on Leetcode but nothing clicked for me like it did this week. Without realizing I was implementing all the techniques I learned from practicing technical interviews into a real life project that contained zero code. I didn’t realize I was doing this until about halfway through the project and then it clicked. I was able to relate my entire process to an algorithm and even improved the algorithm over time just like I would in a technical interview.

The Moment

I live in Arkansas and we just recently had a span of bad storms that completely wiped out my wooden privacy privacy fence. I decided to save a little money and rebuild the fence myself. First, I thought this would be a simple task and I would get it done in a matter of a couple days. Boy was I wrong! This project took me over a week to complete and has been very challenging. I had to remove a lot of old rotten fence posts from the ground and place new fence posts. Then I had to put up all of the structural components needed for the wooden privacy fence. On day two when I was removing the old fence posts from the ground and I had a moment of clarity. The fence post were held in by concrete. I was breaking my back in the hot summer heat trying to remove them from the ground. I kept thinking to myself there has to be a better way to do this. I spent the entire day before removing posts but only was able to remove a few. I had a process but it was very in efficient and also very tiring. I started thinking to myself, how can I make this a little bit quicker? I broke down my current process and I thought about which point of my process was the most tiresome and inefficient. My most inefficient part at that time was trying to fit the chain around the cement block that did not have enough material exposed for the chain to grab. This kept causing the cement block to chip away and my chain to slip off. So I decided to dig around and expose an extra couple inches. This made the process quicker and my chain stop slipping off. I was happy with this process for sometime but then I re-analyze my process and realize that the way I was digging was very inefficient. So I broke down just the digging portion of my process and realize I could use a sharpshooter shovel and then a gardening tool to dig just by the edge. This decreased my dig time and made it a lot easier to expose the concrete. My process was much better but still not quite efficient as I would like. I kept working and then without realizing, subconsciously I realize I could position my high lift farm jack a little better to lift straight up instead of at an angle like I was before. Then it clicked! I stepped back and looked at my process and how it changed. I broke down what worked and what didn’t and realized I had a step by step process for completing my task. That sounds an awful lot like an algorithm to me.

Takeaways

What I ultimately realized is that I took all of my skills for solving technical interview problems and applied it to a non-coding problem. I had a problem in front of me and solved it as soon as I could to start working. I recognized inefficiencies in my process (algorithm). I picked the biggest inefficiency and made it more efficient. Then went to the next inefficiency and continue that process until I had the best performing process for the task at hand. That is exactly what I am doing in my technical interview practice. Having this understanding and seeing it in action outside of code has dramatically improved my technical interview skills.

I share this story to give hope to young coders. It can be very frustrating learning new topics and it seems like some topics never click. Keep working at it and I promise you one day all the dots will connect just like it did for me. Try to apply it to something other than code and something you’re more familiar with. This will help you understand and be able to use it in multiple aspects of life and make things that much easier!

Top comments (0)