v056ped5@ubvmsd.cc.buffalo.edu (Brian M McNamara) (10/09/90)
I am using the latest FST compiler. I was attempting to write a program that developed random strings of characters that resembled English by using some ocurence sampling tables from a text book. What I ended up with was a case construct with 26 possibilities but the range f possibilities was from 1 to 10000. After ten minutes the compiler had not completed the second pass. Can anyone tell me where to look for a possible solution? Brian
Pat.Terry@p101.f4.n494.z5.fidonet.org (Pat Terry) (10/13/90)
In Message-ID: <39707@eerie.acsu.Buffalo.EDU> Brian McNamara writes >I am using the latest FST compiler. I was attempting to write a program ... >ocurence sampling tables from a text book. What I ended up with was a case >construct with 26 possibilities but the range f possibilities was from >1 to 10000. After ten minutes the compiler had not completed the second Yes, Roger admitted to me once that it is very poor in that particular area. >Can anyone tell me where to look for a possible solution? IF a = 1 THEN one ELSIF a = 34 THEN two ELSIF a = 98 THEN three ..... ELSIF a = 26 THEN twentysix? may be clumsy. If you arrange in a clever order matching on probability of occurrence it won't be too bad. Or devise a hashing function or mapping function of your own? -- uucp: uunet!m2xenix!puddle!5!494!4.101!Pat.Terry Internet: Pat.Terry@p101.f4.n494.z5.fidonet.org
preston@titan.rice.edu (Preston Briggs) (10/14/90)
In article <344.2716D868@puddle.fidonet.org> Pat.Terry@p101.f4.n494.z5.fidonet.org (Pat Terry) writes: > >In Message-ID: <39707@eerie.acsu.Buffalo.EDU> Brian McNamara writes > > >I am using the latest FST compiler. I was attempting to write a program >... > >ocurence sampling tables from a text book. What I ended up with was a case > >construct with 26 possibilities but the range f possibilities was from > >1 to 10000. > >IF a = 1 THEN one > ELSIF a = 34 THEN two > ELSIF a = 98 THEN three > ..... > ELSIF a = 26 THEN twentysix? > >may be clumsy. If you arrange in a clever order matching on probability >of occurrence it won't be too bad. Could also arrange a binary decision tree. Or, at some cost in space, build an array 1000 long, and fill in the answers. The multiple IF thing will have cost O(n), where n is the number of possible value for a. A binary decision tree (or a compact array that's binary searched) will cost O(log n), and the big array will be constant time. Normally, I'd pick one of the binary search options. -- Preston Briggs looking for the great leap forward preston@titan.rice.edu