-->
当前位置:首页 > 题库

单选题:Given a linked list containg $$N$$ nodes. Our task is to remove

Luz5年前 (2021-05-10)题库1775
Given a linked list containg $$N$$ nodes. Our task is to remove all the nodes. At each step, we randomly choose one node in the current list, then delete the selected node together with all the nodes after it. Here we assume that each time we choose one node uniformly among all the remaining nodes. What is the expected number of steps to remove all the nodes?
@[A](4)

A. $$\Theta (log N)$$
B. $$N/e$$
C. $$N/2$$
D. $$\sqrt N$$




A.$$\Theta (log N)$$
B.$$N/e$$
C.$$N/2$$
D.$$\sqrt N$$


答案:A