Differences between a definition and an algorithm?

I am hoping that you can shed some light on the differences between a definition and an algorithm.

Let’s take an example. Consider the “absolute value” that you learned in elementary school. Is the following a definition of absolute value, or is it an algorithm for computing the absolute value?

|x| = (if x < 0 then –x else x)

If it’s a definition, what would an algorithm look like?

If it’s an algorithm, what would a definition look like?

Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: