codechefsucks's blog

By codechefsucks, history, 9 years ago, In English

Today i was coding a div2c problem

i got the idea and almost had good pseudo code in my mind

Then i started coding and took more than 2 hours to debug

What was the problem i cant implement because i dont have enough practise or is it because i didnt write down pseudo code ?

Thanks

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

| Write comment?
»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I think you just have to practice more and write more codes

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

just write many mini-functions which helps you to find your mistakes quickly.after many practice it help's you and you will start coding without debuging,as red coders and many others.

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

I think it will help you if you practice at codechef problems

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

Code as much div2 C probelms you can until your coding time is around ~30 minutes for a good level C and about 15-20 for a easy C since level of C question varies a little from round to round.

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

i have been in this situation before .... two tips that works fine for me :

  • Think before coding .. don't rush ,after getting the idea know that you're not done yet and coding might be challenging .

  • write the full code on paper first .... computer bounds your mind , you shouldn't think about code while writing it .you may do that if the problem very easy to implement.

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

Before coding a solution it's a great idea to take some time and just think about it. Clear up the idea in your head and imagine the algorithm in action. It's often helpful to outline the steps your algorithm works in.

However I've personally never written down a detailed pseudo code or any code regarding implementation itself, just the idea and steps of the algorithm. If you have problems debugging that's most likely due to lack of experience. The more you code, the more common mistakes you fix and you learn to read your code and form a style. So in my opinion you should simply solve more and more problems.

And lame bugs that you debug for hours always happen from time to time, but your goal is to make it something rare :)

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

as said in this blog

all you need to do is practise,practise,practise

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

Rewriting the code after you get it accepted once helps! Also check others code (generally of those who are better than you)... It helps more more than it initially appears to.

»
9 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

i think you need to write more codes,i also have the same problem with E,D div2 where there is a big implementation,but after doing a huge number of problems i can write very fast code and most of the time i don't have problems with debugging D or C,but still have problem with E but i also remember the time when i had problems with C,so don't worry just practice,after some time you will be able to do problems with more difficulty quicker and quicker.

P.S. I also don't write the pseodocode.