Answer the question
In order to leave comments, you need to log in
How to learn to come up with simpler algorithms for solving any problem?
Because Since I am going to enter a university for programming, I decided already now, being in the 10th grade, to start learning this. I have already mastered the basics of Python 3, C ++, and now I am mastering HTML, CSS and JS. But I ran into such a problem that I can not think of a simpler algorithm.
This is especially evident in simple tasks, where many other people write an extremely simple, but working algorithm that takes only a couple of time, while I have more and more of these lines ... Moreover, it is not difficult for me to transfer the algorithm to PL, but this difference in the simplicity of the algorithm itself, frustrates me. I understand that this is most likely due to a lack of experience (I have been studying this for only 4 months, before that I only had experience coding in Pascal), but I would like to quickly learn how to come up with simpler algorithms. What can be done in such a situation?
Answer the question
In order to leave comments, you need to log in
The classical approach looks like this: we look at the problem and try to understand how we will solve it with our hands, consider different versions of the problem, make mistakes, try again, get acquainted with it in one word. Then we try to formalize and describe the resulting solution using a programming language.
When I went through this stage, I learned most of all from the book "Mathematics is Easy": https://www.ozon.ru/context/detail/id/31172916/
Despite the word "mathematics" in the title, it is about how to learn how to solve problems for which there is no ready-made solution in your head.
Good luck and patience on this difficult path :)
It's just an experience.
And it may also be a matter of ignorance of the capabilities of the language and the standard library. For example, if you do not know that this is possible, then you will have to write a lot of code instead.r = [a.foo() for a in b if a is not null]
But I did not teach C from textbooks, I just work as a magician ...
PS This is an internal feeling, it really appears with experience, a year or two of commercial development may pass. You suddenly look at your old code and clearly understand how to optimize it. It's magic, you can't learn it.
Another thing are you sure you want to spend your life in front of a computer, digging into the code? There will be money, but real satisfaction and happiness is unlikely.
What is the language here? Algorithms are usually written in a pseudo-language (something like Pascal or Python).
If you are interested in a functional approach, read Haskell or F#.
In programming, you may like the code itself, the language constructs themselves. If it is interesting, then it doesn't matter what application area, although it is desirable that it be an area of interest to you: modeling of physical processes, game development, enterprise applications.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question