Forums Neueste Beiträge
 

1984 war noch der Spagetti Computer in

23/09/2012 - 16:39 von Deckname | Report spam
Das beste Rechen-Werkzeug für uns Physiker sind aber immer noch unsere 5 Finger.

Algorithm Spagetti :

For simplicity, assume you're sorting a list of natural numbers. The sorting method is illustrated using uncooked rods of spaghetti:
For each number x in the list, obtain a rod of length x. (One practical way of choosing the unit is to let the largest number m in your list correspond to one full rod of spaghetti. In this case, the full rod equals m spaghetti units. To get a rod of length x, simply break a rod in two so that one piece is of length x units; discard the other piece.)
Once you have all your spaghetti rods, take them loosely in your fist and lower them to the table, so that they all stand upright, resting on the table surface. Now, for each rod, lower your other hand from above until it meets with a rod--this one is clearly the longest! Remove this rod and insert it into the front of the (initially empty) output list (or equivalently, place it in the last unused slot of the output array). Repeat until all rods have been removed.
 

Lesen sie die antworten

#1 Helmut Wabnig
23/09/2012 - 18:21 | Warnen spam
On Sun, 23 Sep 2012 07:39:33 -0700 (PDT), Deckname
wrote:

Das beste Rechen-Werkzeug für uns Physiker sind aber immer noch unsere 5 Finger.
.



Das ist korrekt.

http://img684.imageshack.us/img684/...ulator.jpg


w.

Ähnliche fragen