Sign in to follow this  

Generally unable to implement an algorithm

This topic is 2549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I think this belongs here, since it's a general programming thing.

But I was about to write a simple algorithm (returns a list of all cells in a grid, can go over 'zone' boundaries and the like)..and I had absolutely no clue how to go about it. I can explain perfectly to myself what I was going to do..I just cannot put it into code easily. I stared at the screen for about 10 minutes, did some other things, came back an hour later..and was perfectly fine implementing it.

Is this just a lack of problem solving practice?

Share this post


Link to post
Share on other sites
Quote:
...and was perfectly fine implementing it. Is this just a lack of problem solving practice?

I agree with Ripoff - "probably." It's what Isaac Asimov (or Arthur C. Clark, I can't locate the quotation) called the "Ah ha!" syndrome. You stare at something and then ... Ah ha!

Practice is the most important aspect of that process, giving your subconscious more possible solutions to sort through. Louis Pasteur said (in French, of course): Chance favors the prepared mind.

Prepare your mind with practice.

Share this post


Link to post
Share on other sites
I wouldn't say that. It's fairly common to have to think about/sleep on a problem before it all comes together. Or to simply get in the right mindset to translate stuff to syntax.

Share this post


Link to post
Share on other sites
How about using the magic and very uncommon and even more unknown tools: PAPER and PEN?

Post-sarcasm text:
I have the same thing with debugging. I'm staring at for 2 hours, give it up. The next day: I spot the bug at first glance

Share this post


Link to post
Share on other sites
Quote:
Original post by szecs
How about using the magic and very uncommon and even more unknown tools: PAPER and PEN?

Post-sarcasm text:
I have the same thing with debugging. I'm staring at for 2 hours, give it up. The next day: I spot the bug at first glance


I have a whiteboard bought for me to 'organise my coursework/schoolwork'. I spend most of the time using that. However, I still couldn't get from pseudocode->working code.

Share this post


Link to post
Share on other sites
I can always divide the stuff to manageable and debuggable pieces (that's a kind of talent, but it comes with practice too).

I usually start by literally writing the pseudocode itself as the main code (good function/variable names are handy). The sentences of it will be the functions. Then I start to code the functions, usually in some debuggable manner. I can't tell any specific details about that, it depends on the algorithm. Then I can see what variables are needed, I add them to the particular function and the main function.

I do this in my paper modeller project, which is all about algorithms.

I hope that helps.

Share this post


Link to post
Share on other sites
Thinking about programming only when you are in front of the computer can be a large part of the problem. You wont fully engage your brain until it has nothing else to do.

One of the biggest Ah ha moments I had in programming happened when I had been away from my computer for a week, and was going to be away from it for several more days.

Share this post


Link to post
Share on other sites
Try solving a few problems. This will definitly help a lot :)

A few websites with programing problems:
http://projecteuler.net/index.php?section=problems
http://ace.delos.com/usacogate (Great programing problems, many of them taken from old IOI competitions)
http://www.codechef.com/

Share this post


Link to post
Share on other sites

This topic is 2549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this