第26717题 判断题
判断汉诺塔分治算法Python代码的时间复杂度是否为O(n log n)
def move(src, tar):
    pan = src.pop()
    tar.append(pan)

def dfs(n, src, buf, tar):
    if n == 1:
        move(src, tar)
        return

    dfs(n - 1, src, tar, buf)
    move(src, tar)
    dfs(n - 1, buf, src, tar)

def solveHanota(A, B, C):
    n = len(A)
    dfs(n, A, B, C)
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析