modular exponentiation?
|
06-25-2018, 05:42 PM
(This post was last modified: 06-25-2018 05:44 PM by StephenG1CMZ.)
Post: #22
|
|||
|
|||
RE: modular exponentiation?
(06-25-2018 02:44 AM)Thomas Okken Wrote:(06-25-2018 02:04 AM)brickviking Wrote: Man, am I glad I've never tried to apply for a professional programmer's job. I've never even heard of binary multiplication chains. I've certainly heard of powers-of-two multiplication by bit-shifting though. I don't know if this is the same thing, nor would I have any idea how to apply that to the OP. Oops: New Reply is inserting a Quote! I too would have flunked that math test... My A level math covered modular arithmetic and exponentiation, but it was too long ago to remember them ever being combined. The straightforward for loop has the advantage of clarity and easily predictable performance (assuming an average execution time for each loop), whereas the mathematical shortcut relies on memory of a trick - and is harder to test for errors if your memory lets you down. Back at the start of my software engineering career, I don't remember doing well on any math algorithms in interviews, but in the job itselfI did implement a 100% performance gain in a sqrt function. The trick there was to choose a good guess for the initial root. I also implemented DSP software in assembler, which I understood well enough to code and test - but couldn't begin to talk about in interviews (apart from explaining the code, rather than the math) Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)