|
Jim Langston wrote: > Incidentally, this "halving" technique is one I learned years ago in school >from a > math teacher. By using the halving technique, you can pick any number from 1 > to 100 within 7 "guesses", <<snip>> Jim, I cut my teeth on this back in the ol' days of the S/3. We had an application generator that worked off an ordered sequential file. The program generator would use the halving technique for each and every reference it encountered. The results were printed as it was created and wouldn't even drive a 200lpm printer. I added a startup routine that built an array of 8 elements, the first, last, and points between. This reduced the number of "halvings" in half and was printer bound. When I took it to the IBM data center and ran it on a mod 15 it spewed code at about 800LPM! Now when you have 20 programmers lined up for compile time it rocked! The good part is that you can double (exponentially) the file and only add one "halving" per exponent. If 7 tries works within 100 records, 8 tries works for 200, 9 tries for 400, 10 tries for 800, 11 for 1600, 12 for 3200, etc. The bigger the file, the greater the gain. BTW, this also can work for ordered arrays and one or two halvings to place a start index will reduce LOKUP time. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact copyright@midrange.com.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.