作业帮 > 数学 > 作业

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

来源:学生作业帮 编辑:拍题作业网作业帮 分类:数学作业 时间:2024/04/29 07:46:25
数据结构里的算法复杂程度怎么计算,如题
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)
C 链表的插入 不管是否有序都是从头遍历,所以
每个节点的概率是1/n
1/n(1+2+...+n)=(n+1)/2
所以是o(n)
再问: 虽然还是不太懂,分给你吧