Algorithms: Difference between revisions

From Helpful
Jump to navigation Jump to search
mNo edit summary
 
mNo edit summary
(One intermediate revision by the same user not shown)
Line 1: Line 1:
===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
 
 
If you ask "how does this thing do X" and you get a detailed, technically satisfying answer, that could be considered an algorithm.
 
This isn't ''exclusive'' to math or computation, but that's where we use the term most.  




This isn't ''exclusive'' to math or computation, but they are the ones that use the term most.
...to differing standards. Say,  
* users may be happy enough when a site mentions that it presents videos based on preference


Note it refers to the method only -- excluding details like the data you feed into it, or the hardware it runs on.
* 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.


Any technically satisfying answer to 'how does it X?' could be considered an algorithm in a pinch.




That said, programmers will often prefer to call things algorithm only when
Around algorithmics, we try to be precise ''enough''
* it is fairly worked out specific theory (e.g. a specific way of sorting), OR
: and prefer simple, well-contained questions, for single tasks, such as "how similar are these two words?" or "how do we sort a list?",  
* 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?"
: 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"  
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".


Note it refers to the method only -- excluding details like the data you feed into it, or the hardware it runs on.


Thy don't ''have'' to be completely implemented and ready to run,
but most of the work left is implementing what is already described writing it out, ''maybe'' figuring out practicalities to supporting systems - but no further architecting of how to move towards getting a result.






Thy don't ''have'' to be completely implemented and ready to run,
but most of the work left is implementing what is already described writing it out, ''maybe'' figuring out practicalities to supporting systems - but no further architecting of how to move towards getting a result.




===What do they look like?===
-->


====What do they look like?====
<!--
Depends, mainly on the complexity, and on what it does.
Depends, mainly on the complexity, and on what it does.


Line 36: Line 42:
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: {{verify}}
<syntaxhighlight lang="python">
for  i  in  1  through  length-of( L )
    for  j  in  length-of( L )  through  i + 1
      if L[j-1] > L[j]  then
          Exchange L[j-1] with L[j]
</syntaxhighlight>


...and {{comment|(even if you would need to rewrite it into ''actual'' code before it actually would run)}} might include some more details, sometime edge case handling, that a worded version does not explicitly mention .


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 60:
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 19:46, 28 June 2024

What does algorithm mean?

What do they look like?