Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
time complexity of int
#2
Assume n is length of the number in bits and let's use ^ for exponentiation.

Addition and subtraction are O(n).

Multiplication uses the Karatsuba algorithm that is O(n^1.585) instead of the classical algorithm which is O(n^2). The details are at https://bugs.python.org/issue560379 More improvements to multiplication are discussed at https://bugs.python.org/issue3944

Division is O(n^2).

There are some enhancement to exponentiation. The details are at https://bugs.python.org/issue936813
Reply


Messages In This Thread
time complexity of int - by Skaperen - Jul-03-2020, 11:18 PM
RE: time complexity of int - by casevh - Jul-04-2020, 08:28 PM
RE: time complexity of int - by Skaperen - Jul-05-2020, 12:08 AM
RE: time complexity of int - by casevh - Jul-05-2020, 05:06 AM
RE: time complexity of int - by Skaperen - Jul-05-2020, 05:58 AM
RE: time complexity of int - by casevh - Jul-05-2020, 03:03 PM
RE: time complexity of int - by Skaperen - Jul-05-2020, 06:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Time complexity different between operating systems. Why? Mekire 2 4,300 Jan-18-2017, 09:29 PM
Last Post: casevh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020