It's tautological to state that for a fixed number of nodes, mutliplication is constant time.
Off course it is. The n is fixed.
Also as a side note, n^2 is not the lowest order algorithm for multiplication.
Off course it is. The n is fixed.
Also as a side note, n^2 is not the lowest order algorithm for multiplication.
For the specific case of m = 236 and n = 4096, it requires 12 multiplication and 12 division operations. For n = 4095, I think it actually requires 22 multiplications and 22 divisions. Also, if m is a compile time constant, the divisions can be implemented as multiplications instead, which gives a constant factor speedup.
https://en.wikipedia.org/wiki/Modular_exponentiation#Right-t...
I think you need an 'n' in there before it is meaningful to ask about the runtime.