Briefly about algorithms and data structures

Briefly about algorithms and data structures

Hello, Habre! My name is Richard and I work in a team kPHP in VK, I am engaged in the development of kPHP, plugins for IDE, and even other tools, making the life of developers easier. In my work, I have to deal with PSI trees, ASTs, self-written data structures and their modifications, and even QuickSelect (and more complex algorithms) I have had to implement. I want to talk a little about one of the cornerstones, perhaps, stones in IT, namely “algorithms and data structures” – the topic has not lost its relevance since the appearance of Habra. I would like to point out in advance that my post is 90% based on personal experience during study, work and teaching.

I will immediately give a short TL; DR and answers to questions:

  1. Does a programmer need to know data structures? It is necessary.

  2. Do you need to know algorithms? Not necessarily. However, it is necessary to understand them, to be able to understand them.

Another question, “Does a programmer need to know mathematics?”, can be deduced from the second point. In fact, the answer will be about the same. Let’s imagine that you will have to dive into algorithms not only at the interview. For example, there will be a task to significantly modify a library or framework to meet the needs of the company, taking the algorithm itself only as a basis. Having even a basic (from school or student) memory of various branches of mathematics behind your shoulders, you will cope with the task much faster.

But I digress, let’s get back to algorithms. There are many articles on Habre where authors and commentators try to reach a consensus with variable success. IN recent post the author, who has needed algorithms only 3 times (sic!) in a 20+ year career in IT, makes a succinct conclusion: “A programmer must be able to traverse an array, which, a tree, can be a linked list.” And I completely agree with him. Although, in my opinion, Dijkstra or Bellman-Ford algorithms would also be good to understand, but I will touch on simpler tasks that should be known at any, even junior, level.

Example one. Its solution does not require knowledge of higher mathematics. With its help, you can check whether a person knows how to work with a linked list and pointers (if the language supports them), or whether he has a general idea of ​​sorting.

The second example is a little more specific. Here it is already necessary to prove why we go around in width or in depth. However, this is still basic data structure manipulation, i.e. no Johnson algorithms.

These tasks test the programmer’s ability to work with data structures, understand their structure and the validity of one or another approach. More complex algorithms should be “sharpened” for the project and what can actually be encountered in the work.

Instead, I can say that studying at university and doing a lot of math allowed me to understand and analyze problems faster, have a potential set of solutions, and know where to dig. I still had to re-read the QuickSelect I mentioned above, but I already knew where to look.

If you are interested in algorithms, but have already forgotten the university course, or did not have it at all, then it so happened that I became a co-author of asynchronous online course “Algorithms and Data Structures” by VK Education. When my colleague Ilya Pochuev and I and the methodologists from the education team were developing it, we wanted to collect all the questions and gaps encountered at the university and try to help solve them in an understandable and modern format. We have created a course that is practice-oriented and guides the student to understand the basic concepts and develop the skills to solve typical problems.

The course “Algorithms and data structures” consists of 4 modules:

For each topic, you will need to complete one to three homework assignments to test your understanding of the material covered. There are also Q&A sessions, where tasks, approaches to solving them, and other issues are discussed in more detail. The course is free and does not require entrance exams. You can apply at any time. And the plus of asynchronous courses is that they can be combined with work or studying at the university. Students choose their own pace of learning.

Then you can deepen the acquired knowledge to, for example, answer for yourself the question “Why does it work this way? What evidence base does the decision have?”. But it is already in your hands – within the framework of studies at a university or on our educational courses with a more in-depth program.

I want to end with a saying: “A good spoon before dinner.” True, it is better to take the right spoon and, at least, know where to find it.

Related posts