perl-Algorithm-Step

Trace execution steps of an algorithm

This is for observing the behavior of algorithms on some algorithm textbooks, such as `The Art of Computer Programming', `Introduction to Algorithms'. I write it only for fun. I have been thinking of how to embed documents in program in a helpful way. The usage is well demonstrated by the example above. * *algorithm* Begins an algorithm. It takes two arguments. The first one is the name of this algorithm, the second one is the short description. * *end_algorithm* Ends an algorithm. * *step* Increase count on this step by 1. It can be nested. A step can be divided into sub steps, like: step 1, "desc"; step 1,1, "desc"; step 1,2, "desc"; step 2, "desc"; * *statistics* Print the execution information. If no argument is give, print to stdout. If a filename is given, print to that file. statistics("prime.stat"); The output looks like: STATISTICS Algorithm P: Print table of 500 primes STEP 1. Start table, PRIME[1] <- 2, PRIME[2] <- 3 .... [1] STEP 2. Advance n by 2 ............................... [1784] STEP 3. k <- 1 ....................................... [1784] STEP 4. Increase k ................................... [9538] STEP 5. Divide n by PRIME[k] ......................... [9538] STEP 6. Remainder zero? .............................. [9538] STEP 7. PRIME[k] large? .............................. [8252] STEP 8. n is prime ................................... [498] STEP 9. Print result ................................. [1]

There is no official package available for openSUSE Leap 15.3

Distributions

openSUSE Tumbleweed