rifat1234's blog

By rifat1234, 11 years ago, In English

Can anyone help me on learning combinatorics by giving some tutorials and nice implementation in c++ ? I have seen the topcoder tutorial , but have not understand it well :( if you give me an implementation in c++ with some comment . it will be great.. :) Thanx in Advance.. :)

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

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

There are lot of different formula for combination because there are lot of different type of it. I will say you 2 type. First, Loto.
Where number N is number in basket, and k number how many I will get out. N! means 1*2*3..*N Second, little bit easier. I have 1 bacteria. After 1 min, 1 bacteria is going to separate to two bacteria. How many bacteria you will have after 5 min. Answer is 2^5=32

Ok, if you understand that up here think about this question. How many different number can we get if you have N different digits and the number can have less then M digits. Answer N^(M+1)

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

Look here. You may try some easy problems from this category, it should help you a lot.

First of all, you should try to solve problem by yourself, if you can not — do it with editorial. After that — read implementations of some skilled users (searching for some useful tricks or realy nice implementation).

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

    Thanks for your kind advice

    I am really confused about when to see the editorial. How much time and effort I should spend trying to solve the problem before seeing the editorial in the worst cases ?

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

      It is realy hard question. In my opinion, 10 minutes is enough. All that easy problems are based on well-known facts and ideas, and wasting your time for finding out that things (instead of simply reading about them in editorial) is not a very good idea.

      But some people say that you need to spend at least an hour on easy problems, and spending even whole evening on some more complicated problems is not a time wasting, especially if you finaly managed to solve the task — it should significantly improve your skill of "solving creativity" and finding out interesting ideas.

      • »
        »
        »
        »
        11 years ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        What really matters is whether you understand for sure the idea or not. If you can solve other similar problem without reading the solution or any editorial, then you got the main idea of that problem.