# Define: Algorithm - I'm a little confused.

Discussion in 'Software Development' started by holcar, Feb 14, 2007.

Not open for further replies.
1. ### holcarThread Starter

Joined:
Feb 13, 2007
Messages:
28
Recently in an exam I sat I was asked to write in an algorithm in which I was familiar how to find the maximum value in an array.

I wrote it out in True Basic how it would be done, but I'm told by a friend that the correct answer should have been written in pseudocode or represented as a flow chart.

If there is a debate over my answer should I accept I did the question wrong? Or should marks be awarded as I was able to represent the steps in True Basic which proves I understood the process?

Any ideas?

2. ### guitarBanned

Joined:
Jan 15, 2006
Messages:
414
algorithm A precise rule (or set of rules) specifying how to solve some problem

3. ### Chicon

Joined:
Jul 29, 2004
Messages:
6,650
Hi holcar,

You may find your happiness here : just have a look to the example (there's only one) !

4. ### VTfletch

Joined:
Jan 25, 2007
Messages:
24
Yeah writing the algorithm in true basic would be considered an implementation of an algorithm. The best way to write an algorithm is in a way that it can be given to ANYONE and them be able to follow it. In any class on algorithms the best example is a cooking recipe, where writing the code would be the actually cooking.

5. ### lotuseclat79

Joined:
Sep 12, 2003
Messages:
20,583
Hi holcar,

If memory serves, by any definition of the term algorithm, from a computer science point of view, an algorithm is a procedure which terminates (see link to Wikipedia given in previous post for confirmation and elucidation on the finer points of that description).

That said, if you were asked to write an algorithm "in which you are familiar" (I take this to be any language with which you are familiar), then your response was ok.

The question is does it produce the correct answer? Even if an algorithm is expressed as a flow chart or in pseudo code - it could be incorrect. Algorithms can be expressed in a variety of ways, and yours is just as valid as any other. Your friend is quibbling about the form of presentation rather than the steps of a procedure that guarantees that the algorithm will terminate with the correct answer.

Do check the code by compiling and executing it to see if it works though.

-- Tom

As Seen On

### Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

over 733,556 other people just like you!