I remember walking into my first technical interview for a software engineering internship. I didn’t know what to expect, for I did no preparation whatsoever and assumed whatever I learned in class up to that point would carry me through the interview.

Oh, how I was wrong.

I walked into a room containing one other person and a whiteboard. The attention was on me.

The interviewer asked me to write a program that, given a start position and an end position in a matrix (a two-dimensional list or array), would find an optimal path from the start position to the end position.

Not having taken an algorithms course yet, I wrote a program that went through most values in the matrix to find the shortest path.

img1

The red cell is my start point and purple cell is my end point. All the blue cells are cells that I searched to find the purple point.
(Source: Elvin Davis)

The interviewer then asked me how I would optimize the program.

I stood there dumbfounded.

Not knowing how to solve the problem at hand, I asked the interviewer for a hint (totally ok to do this if you are ever stuck in a technical interview!). But even with the hint, I was confused. I failed the technical interview and didn’t get the job.

Although the interview was demoralizing, I felt that with the right preparation I could go back and tackle the challenge. The following semester, I signed up for a data structures and algorithms course.

After taking the course, I reflected back on that first technical interview. I realized that with the use of an A* algorithm, that question wasn’t hard at all! I could have optimized my move at every cell in the matrix to find the shortest path. Not knowing those data structures and algorithms cost me a job.

img2

With the optimized algorithm, the red cell is my start point and purple cell is my end point. All the other colored cells are cells I searched. As you can see, I searched a lot fewer cells than my first implementation with this optimized algorithm.
(Source: Elvin Davis)

Not only did the course give me a better grasp of programming fundamentals, but it also made me think of the world differently. All of a sudden, I started modeling and navigating the world through an algorithmic lens.

I would represent my walk to class as a graph of vertices and edges and use the A* search algorithm to figure an optimal path. I would use binary search to search through the library bookshelves until I found the book I wanted, as opposed to looking through the books one by one.

binary-search-small

An interactive applet I built that teaches the principles of binary search. (Source)

Furthermore, knowing these data structures and algorithms also helped me build some cool stuff on my own! I built an application similar to Google Maps that would route the shortest distance to my classes. I also helped build a code style analyzer that uses a clustering algorithm to automatically provide hints and improve people’s code! The possibilities were truly endless.

Learning how to apply data structures and algorithms not only provided me with the necessary knowledge to start a career in software engineering, but it also instilled a confidence in me to reach out again and try to conquer technical interviews.

The year following the course, I once again began applying for software engineering internship positions. I made it through to some technical interviews and began applying what I learned in class to the problems they gave me.

linked-list-screenshot

A lesson on sorting through linked lists from Codecademy’s Computer Science Path

I was asked variations of traversing graphs, sorting through lists, searching through datasets, and more. I was able to show off my ability to think optimally, and this algorithmic thought process landed me a couple of jobs, including one at Codecademy.

At Codecademy, I was honored to work on a team creating the Computer Science Basics: Data Structures and the Computer Science Basics: Algorithms Pro Intensives.

These courses teach the underlying principles of strong programming fundamentals, so you can apply them in your own job searches and careers. I hope you take the courses, and I am excited to see where your learning journey will take you.



Sumber: code news