View Single Post
Old 2021-02-16, 19:34   #794
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

100138 Posts
Default

Quote:
Originally Posted by garambois View Post
. . .
Did I understand correctly, you also have a C++ program that does this job faster ? This other program would also interest me.
Here is the source for a C++ program. I'm afraid it's probably a bit "amateurish," and it has very little internal commenting, but it should compile on linux with:
Code:
g++ alimerge3.cpp -o alimerge3
and can then be invoked by:
Code:
./alimerge3 37 1 80
to run the entire base 37 table. Here's an example (wrapped in date calls to provide timing)*:
Code:
$ date;./alimerge3 37 1 80;date 
Tue 16 Feb 2021 02:19:01 PM EST 
Running base 37 from 1 through 80 . . . 
37^6:i126 merges with 109920:i1275 
37^8:i151 merges with 1632:i37 
37^12:i1057 merges with 10824:i28 
37^18:i1430 merges with 3366:i2 
37^22:i519 merges with 1567300:i0 
37^30:i1193 merges with 35856:i3 
Tue 16 Feb 2021 02:22:27 PM EST
That comes in at about 3:26 to run the entire base 37 table. That's about 206 vs. 1211 seconds for the Bash version.

* I tried to add an elapsed time function, but for some reason the timing was extremely inaccurate with the several methods I tried, so I left it out.
Attached Files
File Type: txt alimerge3.cpp.txt (5.0 KB, 61 views)
EdH is offline   Reply With Quote