java - time complexity for most programming language? -
i read time complexity modular arithmetic in many books . there thing don't understood . read in books following
for mod n, has multiplicative inverse modulo n if , if relatively prime n. when inverse exists, can found in time o(n^3) (where usual n denotes number of bits of n) running extended euclid algorithm. question revolves around *extended euclid algorithm* *is has o(n^3)*
when write in java integrated netbeans or c# or c++ programme line
a = b.modinverse(n) //here java syntax
in general. can line has time complexity o(n^3).
or necessary write same steps extended euclid algorithm.
unless documentation of modinverse
method makes explicit guarantee time complexity, can't create assumptions running time. implementation different depending on runtime/library or version of runtime.
if have access source code, can verify algorithm used. can run own benchmarks different input sizes , you'll pretty image asymptotic behavior of concrete implementation.
that said, it's highly probable popular libraries arbitrary-precision arithmetic utilize best known algorithms basic operations modinverse
.
java performance complexity-theory
No comments:
Post a Comment