Sorting 插入排序运行时间
下列关于插入和选择排序的陈述中哪一项是正确的Sorting 插入排序运行时间,sorting,computer-science,insertion-sort,Sorting,Computer Science,Insertion Sort,下列关于插入和选择排序的陈述中哪一项是正确的 a) insertion-sort runs in omega(n^2) b) the insert operation (for one element) in selection sort takes omega(n^2) time. c) insertion-sort runs in O(n) time d) the removeMin operation in selection-sort takes omega(n) time. (不是家
a) insertion-sort runs in omega(n^2)
b) the insert operation (for one element) in selection sort takes omega(n^2) time.
c) insertion-sort runs in O(n) time
d) the removeMin operation in selection-sort takes omega(n) time.
(不是家庭作业问题,只是做最后的练习)
- 至于A,ω不是
?(查看网站上的老问题)O(N)
- 对于B,插入不是需要
?比较1个元素和整个数组,如果是O(n),那么ω不能是O(N)
n^2
- 对于C,插入排序的最坏情况是
O(n^2)
- 对于D,移除最小值的最佳情况不是
O(1)