Skip to content

Instantly share code, notes, and snippets.

@stevester94
Created October 15, 2015 03:17
Show Gist options
  • Select an option

  • Save stevester94/75a59fb3d2b307f5353a to your computer and use it in GitHub Desktop.

Select an option

Save stevester94/75a59fb3d2b307f5353a to your computer and use it in GitHub Desktop.
snippet for recursive matrix running times
def recTest(n, constant, divisibleBy):
if n <= divisibleBy:
return constant
else:
total = recTest(n/4, constant, divisibleBy)
total = total + recTest(n/4, constant, divisibleBy)
total = total + recTest(n/4, constant, divisibleBy)
total = total + recTest(n/4, constant, divisibleBy)
return total
for n in range(0,100):
numIn = pow(68,n)
print str(n) + "," + str(recTest(numIn, 132464, 68)) + "," + str(recTest(numIn, 143640, 70)) + "," + str(recTest(numIn, 155424, 72))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment