Chap 1

Θ记号

alt

alt

图3-1

alt

O记号

alt

Ω记号

alt

定理 3.1

alt

alt

o记号

练习

1.相对渐近增长

alt

2.根据渐近增长率排序

alt

3.渐近记号的性质

alt

4.

Consider sorting n numbers stored in array A by first finding the largest element of A and exchanging it with the element in A[n]. Then find the second largest element of A, and exchange it with A[n-1]. Continue in this manner for all n elements of A. Write pseudocode for this algorithm, and answer the following questions:

What loop invariant does this algorithm maintain?

Give the best-case and worst-case running times of selection sort in asymptotic notation.

考虑通过首先找到A的最大元素并将它与[n]中的元素进行交换来排序存储在数组A中的N个数。然后找到A的第二大元素,并将其与A[n-1]交换。以这种方式对A的所有n个元素继续。为此算法编写伪代码,并回答以下问题:

这个算法保持什么循环不变量?

用渐近表示法给出选择排序的最佳和最坏情况运行时间。

【学习】算法设计与分析 文章被收录于专栏

基于《算法导论(第3版)》 Chap 2 算法基础 Chap 3 函数的增长 Chap 4 分治策略 Chap 6 堆排序 Chap 8 线性时间排序 Chap 9 中位数和顺序统计量 Chap 15 动态规划 Chap 16 贪心算法 Solutions:https://walkccc.github.io/CLRS/

全部评论

相关推荐

风中翠竹:真的真的真的没有kpi。。。面试官是没有任何kpi的,捞是真的想试试看这个行不行,碰碰运气,或者是面试官比较闲现在,没事捞个人看看。kpi算HR那边,但是只有你入职了,kpi才作数,面试是没有的。
双非有机会进大厂吗
点赞 评论 收藏
分享
Rena1ssanc...:对的,要是面评没太烂,勤更新简历等捞就行了,腾讯可以无限复活
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务