数据结构里的算法复杂程度怎么计算,如题

问题描述:

数据结构里的算法复杂程度怎么计算,如题
There is an algorithm with inserting an item to a ordered SeqList(顺序链表) and still keeping the SeqList ordered.The computational efficiency of this inserting algorithm is ( ).
A.O(log2n) B.O(1)
C.O(n) D.O(n2)
1个回答 分类:数学 2014-10-27

问题解答:

我来补答
C 链表的插入 不管是否有序都是从头遍历,所以
每个节点的概率是1/n
1/n(1+2+...+n)=(n+1)/2
所以是o(n)
再问: 虽然还是不太懂,分给你吧
 
 
展开全文阅读
剩余:2000