查找调用许多过程的过程的增长顺序

Finding the order of growth of a procedure that calls many procedures

这段代码创建了一个平衡二叉搜索树,它是两个平衡二叉搜索树的交集。

(define (intersection-tree t1 t2)
    (list->tree (intersection-set (tree->list-2 t1) (tree->list-2 t2))))

也就是说,我有一个调用 4 个采用 Theta(N)(列表-> 树、交集、两个树-> 列表)的过程的过程。我猜所有这些都需要 4N。忽略常数因子,它变成 Theta(N)。说相交树过程采用 Theta(N) 是否正确?

您的猜测是正确的,因为在您的函数中每个子任务只执行一次,使用 Theta(N),执行固定次数,intersection-tree 过程使用 Theta(N)。