Intro to Algorithms

Joshycsm
3 min readJul 18, 2020
https://blog.soshace.com/10-sorting-algorithms-interview-questions-theory-and-practice-for-2019/

What are algorithms? All the companies these days are using them to make it sound like they are doing something really important. Everyone has a secret algorithm that they use to make machine learning models, analyze user data, and make companies lots of money. But under the hood, algorithms are just functions that programmers write. A two line function is technically an algorithm. A thousand line algorithm that sorts through images is also an algorithm. Algorithms are simply steps in a process that we take to perform a desired action with computers.

If we went to Wikipedia and searched “list of algorithms”, we would stumble upon an endless list. It’s impossible to know all of them. You can create your own algorithms, as well as, use other algorithms that are either popular or well-established.

Coming back to the original question, “What are algorithms?”… If we combine our knowledge of data structures, algorithms allow us to use language built in data structures like arrays and objects; or primitives, such as in integers and booleans; and even custom data types, like when we use the class keyword to create stacks, queues, binary search trees. Algorithms allow us to use these data structures to perform actions on that data.

Remember this: data structures and algorithms create programs.

Class {} + function() = Programs

We’ll talk about the most common interview algorithms, the ones that matter mainly for interviews but also in your career.

Ok, so let’s look at the below lists.

Data Structures: Arrays, Stacks, Queues, Linked Lists, Trees, Tries, Graphs, Hash Tables

Algorithms: Sorting, Dynamic Programming, BFS + DFS (Searching), Recursion

Why are the following data structures and algorithms so common in interviews and especially in big companies?

Well, you can get away with not knowing these topics for a long time as a programmer. But as we have learned based on previous blog post, Big O and scalability become increasing important as companies become larger and larger. By learning these listed algorithms, we are able to do a majority of the scaling we need to improve our programs.

Certain algorithms allow us to simplify our Big O complexity into smaller or better time complexity. So that by using the right algorithm, we can take a function that has a Big O notation of O(n²), down to O(n log n) or something that has a linear time complexity to O(log n). And these are used everywhere in large companies because large companies handle lots of inputs and lots of data. So this topic is extremely important to them. As your career grows and grows, these topics will be more and more important to you.

Tune in to future blog posts for more in depth understanding and resources to tackle learning more about algorithms.

I highly recommend the Zero to Mastery Academy to improve your own personal skills as a programmer as this is where all this information was drawn from and Andrei Neagoie, the founder and lead instructor, has been a true mentor to me.

Photo credit: https://blog.soshace.com/10-sorting-algorithms-interview-questions-theory-and-practice-for-2019/

--

--