Rabu, 29 Mei 2013

Random Algorithm Number & Letter Method

A randomized algorithm is an algorithm which employs a degree of randomness as part of its logic. The algorithm typically uses uniformly random bits as an auxiliary input to guide its behavior, in the hope of achieving good performance in the "average case" over all possible choices of random bits. Formally, the algorithm's performance will be a random variable determined by the random bits; thus either the running time, or the output (or both) are random variables.
One has to distinguish between algorithms that use the random input to reduce the expected running time or memory usage, but always terminate with a correct result in a bounded amount of time, and probabilistic algorithms, which, depending on the random input, have a chance of producing an incorrect result (Monte Carlo algorithms) or fail to produce a result (Las Vegas algorithms) either by signalling a failure or failing to terminate.
In the second case, random performance and random output, the term "algorithm" for a procedure is somewhat questionable. In the case of random output, it is no longer formally effective. However, in some cases, probabilistic algorithms are the only practical means of solving a problem.
In common practice, randomized algorithms are approximated using a pseudorandom number generator in place of a true source of random bits; such an implementation may deviate from the expected theoretical behavior.

example :
A      B     C     D      E     F      G     H     I     J      K     L     M     N     O     P     Q      R      S     T     U     V      W     X     Y      Z
Z     Y     X     W     V     U     T     S     R     Q      P     O     N       M    L     K     J     I       H     G     F     E      D      C      B     A

For Number ( student number) :
we assume  there were 30 student in a class Sistem Information :

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

picture line 1.0

so, here are students sit-mates 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
30 29 28 27 26 25 24 23 22 21 20 19 18 17 16

picture line 2.0

in number above we see that student with number 1 and number 14 are sit-mates, and so on..
then, next week, or next day, student number 1 and number 14  are sit-mates, look at picture below
 1   2   3   4   5  6 7       15    29 28 27 26 25 24 23
14 13 12 11 10 9 8       30    16 17 18 19 20 21 22

  1      2     3    4   5  6     7   25  24  23  22  21  20
13   12   11  10   9  8    26  14  15  16  17  18  19

picture line 3.0

so the algorithm method is number 1 (first) partner with number 30 (last) ,
first partner with last second first (second) partner with second last..

Tidak ada komentar:

Posting Komentar