算法导论 CH01 The Role of Algorithms in Computing
来源:互联网 发布:全球进出口数据 编辑:程序博客网 时间:2024/05/30 22:48
算法导论 CH01 The Role of Algorithms in Computing
1.1算法
Algorithm是将输入转换为输出的计算步骤的一个序列
若对每个输入实例,算法都能以正确的输出停机,则称本算法是正确的;
不正确的算法可能根本不停机,也可能以不正确的回答停机。
难题:
- NP完全问题,迄今为止找不到对一个NP完全问题的有效解法,但是也没人可以证明NP完全问题确实不存在有效算法。
- 对NP完全问题,是否存在有效算法是未知的
- NP完全问题集有一个非凡的性质: 如果任何一个NP 完全问题存在有效解法,那么所有的NP完全问题都存在有效解法。
- 有些NP完全问题存在离正确解不太远的近似解。
Exercise
Exercises 1.1-1
Solution:
排序应用:如电商网站对商品按价格进行排序
矩阵相乘:需要找到最优的运算次序最少的运算次数,矩阵相乘在人工智能上用到很多Exercises 1.1-2
Solution: 内存使用, 资源占用Exercises 1.1-3
Solution:
数组:访问速度快,但是删除和插入元素操作慢,无法动态扩容
链表:删除和插入元素快,但是随机访问速度慢Exercises 1.1-4
Solution:
最短路径问题是找到图中两个点的最短路径
旅行商问题是遍历图的全部顶点并且回到原来的顶点,是一个全排列问题Exercises 1.1-5
Come up with a real-world problem in which only the best solution will do. Then come up with one in which a solution that is “approximately” the best is good enough.
Solution: no answer
1.2 作为一种技术的算法
插入排序:
归并排序:
Exercises 1.2-1
Solution: 导航算法的运用Exercises 1.2-2
Solution:
插入排序:8n2
归并排序:64nlgn
当 n < 43时插入排序较好Exercises 1.2-3
100n2<=2n 解得 n >= 15
故 n 的最小值为15
- 算法导论 CH01 The Role of Algorithms in Computing
- 算法导论 CH01 The Role of Algorithms in Computing
- Chapter 1 The Role of Algorithms in Computing
- Introduction to Algorithm - Summary of Chapter 1 - The Role of Algorithm in Computing
- Algorithms and Data Structures: The Science of Computing
- 算法导论一:Analysis of Algorithms
- OpenWRT in the role of upstream
- Significant Changes in the Role of Women
- The role of Roles
- The role of JNDI in J2EE(FROM IBM)
- The Role of Delegation Tokens in Apache Hadoop Security
- 论文:The Role of Emotions in Context-aware Recommendation总结
- The core of cloud computing in my understanding
- The Program of Algorithms ------- Sorting in Linear Time---- Counting Sort
- The Program of Algorithms ------- Sorting in Linear Time---- Bucket Sort
- The Importance of Algorithms
- The Importance of Algorithms
- MIT Algorithms(算法导论一)
- 89. Gray Code
- VS2010 CString与char互相转换的方法
- Java中ArrayList源码
- leetcode:H-Index II
- spring-aop前奏-JDK代理
- 算法导论 CH01 The Role of Algorithms in Computing
- Code Blocks从新打开也关闭的界面
- 任务控制块
- get、post、httpclient-get、httpclient-post
- 诉衷情
- Linux命令--待完整
- 【九度OJ】题目1023:EXCEL排序 解题报告
- Apache 配置https虚拟主机
- C/C++ 常量