m.sabouri's blog

By m.sabouri, 10 years ago, In English

Hello everyone,

Hope you are doing well.

I have been asked quite a few times about how people new to competitive programming can improve their skills. Therefore, I decided to write some suggestions in my blog in case someone is interested.

http://mdotsabouri.blogspot.com/2014/10/my-recipe-to-improve-your-programming.html

Wish you the best.

  • Vote: I like it
  • +59
  • Vote: I do not like it

| Write comment?
»
10 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

A useful list of must know algorithms, their tutorials and problems based on that: http://discuss.codechef.com/questions/48877/data-structures-and-algorithms :)

»
10 years ago, # |
  Vote: I like it +16 Vote: I do not like it

Great work , but do you think 10 minute thinking is enough for beginners.

  • »
    »
    10 years ago, # ^ |
      Vote: I like it +16 Vote: I do not like it

    Definitely. A beginner is unfamiliar with a lot of common algorithms and ideas out there, which an experienced coder knows by instinct.

    There's really no point in investing time on a problem which might be impossible for you to solve. If someone's a beginner and they cannot find a solution in 10 minutes, 80% of the time they need more knowledge on the subject of that problem, and cannot solve the problem unless he/she re-invents the algorithm used on his/her own.

    Of course, sometimes you could actually solve the problem if you spent more time on it. But the value of the new ideas and solutions you gain by reading and implementing many solutions definitely outweighs spending time on thinking, most of the time not leading to a solution.

    • »
      »
      »
      10 years ago, # ^ |
        Vote: I like it +24 Vote: I do not like it

      I think it makes sense for beginners to skip problems after spending a certain amount of time.

      I think "cannot solve the problem unless he/she re-invents the algorithm used on his/her own." is really true, and it's usually impossible to re-invent algorithm.

      For example, I will never every ever ever in million years be able to solve shortest path problem without reading about Dijkstra's algorithm, and I can say with absolute certainty that I will never be able to re-invent DSU by myself.

      But now I can solve those problems in like 2 secs since I know them.

      A friend of mine was working on a certain problem for 2 hours until I tell him it requires segment tree. He is really smart, but I don't think he can come up with segment tree.

      Of course, there are problems that don't require any knowledge but ideas, but since beginners get stuck easily and usually can't tell what kind of problem it is, I'd say it's smart to set time frame.

      • »
        »
        »
        »
        10 years ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        Thanks, you explained the points I tried to make way better and more clear than me. :)

        • »
          »
          »
          »
          »
          10 years ago, # ^ |
            Vote: I like it +13 Vote: I do not like it

          got your point and this is almost true , again great work keep up that fantastic work hope to see other blogs from you soon

»
10 years ago, # |
  Vote: I like it +7 Vote: I do not like it

I disagree with the claim that coding skills come before problem solving skills. It's easier to learn to think in a programming language than in algorithms. If you can solve problems, you can learn how to implement them in a short time, and by raw, mindless problem solving. If you only know how to code already prepared ideas, it'd take you much, much longer to get used to the algorithmic nature of problems.

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    So you mean at first we need to work more on learning algorithms and problem solving skills then work on coding skills? We have many examples of people in my university that knew a lot of algorithms but could not code and get problems accepted in ICPC. I think being able to use an algorithm you know in a short and efficiant time is one important factor. I mean deep small knowledge seems more practical than shallow wide knowledge.

    • »
      »
      »
      10 years ago, # ^ |
        Vote: I like it -15 Vote: I do not like it

      There's a difference between university level and ICPC level knowing. In university, you learn to use what you need in reasonable time and understand how it works, but in ACM, you need to know everything almost immediately. Trust me, even if these people could code perfectly (without knowing about algorithms) before taking a CS course in university, it wouldn't change the result at all.

      In ICPC, you need a very specific type of skills that aren't really achievable in real world programming — it's like every other sport, doing something not very practical, but taking it to the extreme. But if you know the math behind it, you can move forward; if you only know how to implement already complete ideas, you can't, because you don't have these ideas.

      And of course, I'm talking about training to reach a high level (top 100, top 50 active competitive programmers in the world...); if it's not about high level, then there's no point debating over how to half-ass things best.

»
10 years ago, # |
  Vote: I like it +13 Vote: I do not like it

Thanks for interesting article:) I agree with most parts of it, so i saved it — in case someone will ask me "i am beginner, what i have to do?", like it often happens:)

And my advice for beginners is to participate in some contests/virtual contests/trainings with a lot of problems, and go straight to editorial right after contest. It will help to get some basic coding skills (because of large number of problems), learn a lot of new ideas (again, because of large number of different problems), it naturally gives you some time bounds (you will not think on problems for too long time, because of fixed duration of contest), it will make you familiar with participation in contests and also increase your endurance and productivity (you will not think "ok, i worked on this problem for 20 minutes already, i am tired, i'll go drink some tea and read news, i need some rest now"). And you can compare your performance with other contestants to see improvement during time:) Also you'll see your weak sides — like slow coding, solving wrong problems, bad performance in graphs/strings/math...

»
5 years ago, # |
  Vote: I like it +5 Vote: I do not like it

This is exactly the reason i stuck in my problem solving skill up to now. I always spend so much time until i decide to see the editorial, even a whole day. I realized this mindset took me so much time and i gain my skill very slowly. From now on, I will apply your recipe, i hope i will progress faster.

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Did you find this method helpful..any improvements because of this??

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yes, you can see my rating increased a lot since I wrote that comment. I have solved more problems and it helps me improve my recognition and intuition ability.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        Now I will do the same....directly go to editorial rather than wasting hours on thinking

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I also do the same, almost waste my 1-2 hours on a single 1700 rating problem and end up getting tired....now i should change my habit

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Is this idea of trying only 15 minutes still valid since div2(A-D) most times doesn't require any algorithmic knowledge? I try and try for many hours and fail most of the time. Some users suggested me to think as long as I am not stuck or out of ideas(I am using this technique for a while).

What if I say I know a specific STL/data structure/algorithm/technique to solve problem C (suppose in cf DIV2), but I can't come up with a solution in a 15 minutes+- will it be a good ideaif I see the tutorial without trying more time without finishing thinking and carry on with understanding the editorial?

Or did you mean anything else with 15 minute trying like If I have tried for 15 minutes and nothing absolutely nothing comes in my mind? In this case I also understand reading tutorial will be good.

Correct me if I am wrong. Thank you in advance...

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You have played more than 50 contests still you are pupil , no doubt your learning style has to be changed i am not saying rating is everything....but if you are giving so much time for coding you should also get results

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I completely agree with you. I am kind of at a fix. Can you suggest me some better option? And again I have turned pupil just in last educational round. I have a strong believe that I will go down again in next rated div2 or any round I participate...

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I think reading tutorial and solving harder problems than your level can be helpful

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I try to solve harder problems but I don't understand tutorial well. And read tutorial only if I am really stack.. Sometimes I tend to waste 10 or more hours in Problems rated above 1600 or 1500..That one I find it hard. And for some problems I am completely at a loss. In that case I usually try to get help after 2 hourse+ from anywhere I could including tutorial.. or give up...

          Am I going well?

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            see, there is a rule ......> "Everytime you get stuck you learn something new"....so if you are not able to solve the question even after thinking for 30 minutes it means that you are unaware of the concepts which are required for the problem to be solved...so just jump on the tutorial.Solving 5 hard problems in a day reading tutorials is always better than solving just 1 problem per day without it.

            If you can't understand turorial then you can read discussions...