Advertisement

Algorithms?

Started by April 09, 2002 06:59 PM
6 comments, last by Wachar 22 years, 7 months ago
What are algorithms exactly? Can YOU creat them or is it something already made for you? <<<<<<<<<<<<<<>>>>>>>>>> <than you. > <<<<<<<<<<<<<<>>>>>>>>>>
Wachar's Eternity <-<-<-<-<- Me own site!
al-go-rithm: n. A step-by-step problem-solving procedure, esp. an established, recursive computational procedure with a finite number of steps.

To actually answer your question, programming-wise, an algorithm is just a method of computing something in a step-by-step manner (example: the A* pathfinding algorithm, which is a mathematical method of finding the best path between 2 points on a map).

A lot of algorithms have already been created for you (aforementioned A*, for example), but it''s not illegal to create your own.
Advertisement
Would you do that through a regular function call??

Always will be smarter
than you,
--=ME=--
Wachar's Eternity <-<-<-<-<- Me own site!
I guess "algorithm" is sort of a vague term. All an algorithm is is a method to achieve a certain result. You can put the code for an algorithm in a function, or in a class if you like.

An algorithm is a step-by-step method you come up with in your head to solve a problem. Code you write to execute your algorithm on a computer is its implementation.
Algorithms are not ''code'' or ''functions''.

Algorithms are abstract descriptions of how a particular problem can be solved. It''s sort of a step-by-step description of what to do. Then it''s up to you (or someone else) to actually do it (i.e. implement it in code).
quote: Original post by Wachar
Always will be smarter
than you,
--=ME=--


I hate your mentality.



An example algorithm:

Start at zero
x = 0
Loop until 1000
test if x is divisable by ten:
It is: Display text
Is not: Do nothing
Loop continues


Then written in code...:



      for(int i = 0; i <= 1000; i++){   if ((i % 10) == 0)   {      cout << i << " is divisable by ten without remainder\n";   }}      




_____________________________________________________

ICQ #: 149510932

Google - OpenGL - DirectX - Windows Guide Network - MSDN - Symantec Virus Info

"Imagination is more important than knowledge." - Albert Einstein



[edited by - Programmer One on April 9, 2002 8:56:46 PM]
Advertisement
A recipe for baking a cake is an algorithm. It is a step-by-step process to reach a certain conclusion.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Sorry...Programmer One.

----------------------
Always will be smarter
than you,
--=ME=--
----------------------
Wachar's Eternity <-<-<-<-<- Me own site!

This topic is closed to new replies.

Advertisement