Algorithms: Difference between revisions

From Helpful
Jump to navigation Jump to search
mNo edit summary
 
mNo edit summary
Line 2: Line 2:
===What does algorithm mean?===
===What does algorithm mean?===


A mechanically description of getting a particular thing done.
A mechanical, fairly detailed description of getting a particular thing done, a particular method towards a particular goal




This isn't ''exclusive'' to math or computation, but they are the ones that use the term most.
If you ask "how does this thing do X" and you get a detailed, technically satisfying answer, that could be considered an algorithm.


Note it refers to the method only -- excluding details like the data you feed into it, or the hardware it runs on.
This isn't ''exclusive'' to math or computation, but that's where we use the term most.
 
 
...to differing standards. Say,
* users may be happy enough when a site mentions that it presents videos based on preference
 
* programmers may not call something an algorithm when it's only specified at the level of "and then it reweigh videos based on user tags",
: but only once it is unambiguous, possibly pseudocode, or already concrete enough to just run.
 
 
 
Around algorithmics, we try to be precise ''enough''
: and prefer simple, well-contained questions, for single tasks, such as "how similar are these two words?" or "how do we sort a list?",


Any technically satisfying answer to 'how does it X?' could be considered an algorithm in a pinch.
: over more complex such as "how do we evaluate a weather forecast for the next day?" or "how do we distribute processing power between running programs"




That said, programmers will often prefer to call things algorithm only when
Note it refers to the method only -- excluding details like the data you feed into it, or the hardware it runs on.
* it is fairly worked out specific theory (e.g. a specific way of sorting), OR
* it is already concrete enough to just run.


...and prefer simple, well-defined, questions, for single tasks, such as "how similar are these two words?"
or "how do we sort a list?",


...to the more complex such as "how do we evaluate a weather forecast for the next day?" or "how do we distribute processing power between running programs".




Line 36: Line 43:
There are a lot of things you can describe fully with words, and a little math.
There are a lot of things you can describe fully with words, and a little math.


Say, bubble sort is an algorithm that, in English, goes something like "step though a list one at a time. At each position, look at the pair. If the are not in the right order, swap them. Repeat going through the list until you didn't need to swap anything".


There are some things that build on much larger building blocks,
Writing down the same in [[pseudocode]] is not much longer than that, and might include some more edge cases the above does not explicitly mention, even if you would need to rewrite it into ''actual'' code before it actually would run.
 
 
 
Say, bubble sort is an algorithm that, in english, goes something like
"step though a list one at a time. At each position, look at the pair. If the are not in the right order, swap them. Repeat going through the list until you didn't need to swap anything". (which you might note is a dumber variant of how you might sort playing cards in your hand)
 
You might also imagine that writing this down in [[pseudocode]] is a short and pretty complete description of everything it does,
even if you would need to write it in ''actual'' code before it actually would run.
 




Line 52: Line 51:
Note that neural nets aren't algorithms in this sense,  
Note that neural nets aren't algorithms in this sense,  
because while we know how they function,  
because while we know how they function,  
they entangle everything they do in one fuzzy mess.
they do not function without data - in fact they entangle everything they do in one fuzzy mess.
 
In particular, they entangle ''what'' runs into ''how'' it is evaluted.  
In particular, they entangle ''what'' runs into ''how'' it is evaluted.  
The software becomes part of the hardware in a way,  
The software becomes part of the execution environment in a way,  
which is something programmers typically kept separated.
which is something programmers typically kept separated.



Revision as of 18:25, 28 June 2024