Advertisement

algorithms

Started by November 25, 2002 08:29 PM
1 comment, last by popcorn 21 years, 11 months ago
it is often suggested that you should write algorithms for your program before you code it but what kind of steps should you take in writing an algorithm. I often find this a difficult process and was just wondering how other people handle this.
How about them apples?
I usually write out something abbreviated, like:

Open file
Read records
Close file

Then I'll add details to Read records, since it might involve parsing a line and tokenizing it.

I may also add to Open File a check that makes sure the file was successfully opened.

In short, I start out with a generalized algorithm that gives me a quick picture of what I'm doing, then I'll pick a specific item that occurs to me and drill down to more detail with it, and continue with the remaining items until I have enough to structure some code out of it.

The primary algorithm lines serve well as comments above each block of code in the final product.


[edited by - Waverider on November 25, 2002 10:19:42 PM]
It's not what you're taught, it's what you learn.
Advertisement
I take it that writing an algorithm is something that you get better at with practice though.

Usually when i think about a problem and write an algorithm for it i usually start out with something simple like you but to me it always looks wrong like theres always something more to it and i usually cant''t think what, but thanks for the reply Waverider.
How about them apples?

This topic is closed to new replies.

Advertisement