2021-04-14 16:25:22 +03:00
|
|
|
class Node:
|
|
|
|
def __init__(self, left, right):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
|
|
|
|
|
|
|
def makeTree(depth):
|
|
|
|
if depth <= 0: return Node(None,None)
|
|
|
|
let n1 = makeTree(depth-1)
|
|
|
|
let n2 = makeTree(depth-1)
|
|
|
|
return Node(n1,n2)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from timeit import timeit
|
2022-06-02 02:01:55 +03:00
|
|
|
print(min(timeit(lambda: makeTree(16), number=1) for x in range(10)), 'makeTree')
|