0
2次のv2が他の関数で重要な二次および他の小さな詳細であることを説明できますか?私は、渡された変数が二次的であるために二度呼び出されなければならないと思いました。私は単純な複雑さを理解する助けが必要です
def linear(L):
index = 0
while index < len(L):
index = index + 1
def linear_v2(L):
index1 = 0
while index1 < len(L):
index2 = 0
while index2 < 1000000:
index2 += 1
index1 += 1
def quadratic(L):
index1 = 0
while index1 < len(L):
index2 = 0
while index2 < len(L):
index2 += 1
index1 += 1
def quadratic_v2(L):
index1 = 0
while index1 < len(L):
index2 = 0
while index2 < index1:
index2 += 1
index1 += 1
def cubic(L):
index = 0
while index < len(L):
index2 = 0
while index2 < len(L):
index3 = 0
while index3 < len(L):
index3 += 1
index2 += 1
index +=1
def log(L):
index = 0
while 2 ** index < len(L):
index += 1
def exponential(L):
index = 0
while index < 2 ** len(L):
index +=1
コードを正しくフォーマットしてください。バックティックを削除し、コードを強調表示して、ctrl + Kを押します。そしてあなたの問題をより詳しく説明してください。 – Carcigenicate