Trabb Pardo–Knuth Algorithm
This article is not about learning some new complex algorithm, its more about the history of programming. TPK was introduced to illustrate the evolution of computer programming languages. By the time you are finished with this article you will have learnt something about the history of programming rather than a new concept.
In their 1977 work “The Early Development of Programming Languages”, Trabb Pardo and Knuth introduced a small program that involved arrays, indexing, mathematical functions, subroutines, I/O, conditionals and iteration. This program was written in several early programming language to show the evolution of programming languages.
Just like the “Hello World!” program has the purpose of introducing beginners to programming the TPK has the same purpose and has no practical applications.
Algorithm: input 11 numbers into a sequence A reverse sequence A for each item in sequence A call a function to do an operation if result overflows alert user else print result
Output: 10 346.629846 9 TOO LARGE 8 TOO LARGE 7 TOO LARGE 6 123.647939 5 136.732051 4 TOO LARGE 3 TOO LARGE 2 TOO LARGE 1 TOO LARGE 0 TOO LARGE
This article is contributed by Palash Nigam . If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.