Source: 📖 Problem Solving with Algorithms and Data Structures using Python 3.6
Date: 2021-10-27
A constant runtime function is when an algorithms takes the same amount of time regardless of the size of input n.
As a toy example, here is a function that simply adds 1 to an input n. The runtime remains the same regardless of how big n becomes.
def add_one(n):
return n + 1