数据结构里的算法复杂程度怎么计算,如题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)

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 17:52:50

数据结构里的算法复杂程度怎么计算,如题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)
数据结构里的算法复杂程度怎么计算,如题
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)

数据结构里的算法复杂程度怎么计算,如题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)
C 链表的插入 不管是否有序都是从头遍历,所以
每个节点的概率是1/n
1/n(1+2+...+n)=(n+1)/2
所以是o(n)