A Programming Example - Procedural Recursion: Reverse Order A file called fruit.txt contains the names of a number of fruits, each on a separate line. The task is to output these names in the reverse order that they appear in the file. Reverse an array. Problem. I have an Array and want to reverse it (reverse the order of its contents). Recipe // Initialize the Array var a = [1,2,3,4,5,6] // Reverse its contents a = a.reverse() print(a)
In order to test the speed of the different sorting algorithms I made a C++ program which runs each algorithm several times for randomly-generated arrays. The test was run in a Pentium4 3.4GHz running Suse 9.3, and the program was compiled using gcc 3.3.5 with the compiler options "-O3 -march=pentium4".