Princeton Algorithms: Part 1 [Final Exam Part I]
来源:互联网 发布:雕刻大师软件 编辑:程序博客网 时间:2024/06/05 16:54
Explanation:
The correct answer is: 48 29 18 24
Here is the array to be searched after each compare:
12 18 24 29 40 41 45 48 49 65 70 73 77 84 91
48: 12 18 24 29 40 41 45 - - - - - - - -
29: 12 18 24 - - - - - - - - - - - -
18: - - 24 - - - - - - - - - - - -
24: - - - - - - - - - - - - - - -
Explanation:
The theoretical order-of-growth is N ^ (52/15) = 3.47
The empirical order-of-growth is N ^ (log_2 ratio)
log_2
N seconds ratio ratio
---------------------------------------
32 0.000 - -
64 0.003 - -
128 0.026 8.67 3.12
256 0.281 10.81 3.43
512 3.173 11.29 3.50
1024 35.897 11.31 3.50
2048 391.666 10.91 3.45
4096 4336.940 11.07 3.47
Explanation:
The answer is : N log N
The i loop iterates lg N times; the j loop iterates N times.
Explanation:
The correct answer is: 0 1 3 5 2 4 6
0: Original input
1: Selection sort after 12 iterations
3: Mergesort (top-down) just before the last call to merge()
5: Heapsort after heap construction phase
2: Insertion sort after 16 iterations
4: Quicksort (standard, no shuffle) after first partitioning step
6: Sorted
Explanation:
The correct answer is: F D D D D
Explanation:
The correct answer is: C C A A C C
Explanation:
The correct answer is: C A B B C A
Explanation:
The correct answer is: B B B B C B
Explanation:
The correct answer is: F F A F J F
0 0
- Princeton Algorithms: Part 1 [Final Exam Part I]
- Princeton Algorithms: Part 2 [week 7: Final Exam Part II]
- 【Java、算法】Princeton Algorithms Part I Week 1 Exercise
- Stanford Algorithms: Design and Analysis, Part 1 [Final Exam]
- Princeton Algorithms: Part 1 [week 3:Mergesort]
- Princeton Algorithms: Part 1 [week 3: Quicksort]
- Princeton Algorithms: Part 1 [week 1:Analysis of Algorithms]
- Stanford Algorithms: Design and Analysis, Part 2 [Final Exam]
- Princeton Algorithms: Part 1 [week 1:Union Find]
- Week 1 Assignment - Wordnet - Princeton - Algorithms Part II
- Princeton Algorithms: Part 1 [week 2:Stacks and Queues]
- Princeton Algorithms: Part 1 [week 2:Elementary Sorts]
- Princeton Algorithms: Part 1 [week 4: Priority Queues]
- Princeton Algorithms: Part 1 [week 4: Binary Search Trees]
- Princeton Algorithms: Part 1 [week 5: Balanced Search Trees]
- Princeton Algorithms: Part 1 [week 6: Hash Tables]
- Princeton Algorithms: Part 2 [week 1: Undirected Graphs]
- Princeton Algorithms: Part 2 [week 1: Directed Graphs]
- OpenStack 中的neutron-server启动过程
- menu.addIntentOptions添加动态菜单
- 『黑马程序员』第五话<集合框架>
- Spring3中用注解直接注入properties中的值
- 一个lua代码中的bug引起的思考:不要被c++ crash堆栈误导
- Princeton Algorithms: Part 1 [Final Exam Part I]
- mini2440裸机试炼之—计算器(LCD显示,触摸屏中断)
- 判别模型与生成模型的区别
- 设置点击ProgressDialog外的区域对话框不消失
- MFC锁定桌面,屏蔽任务管理器
- Android 手势锁
- Petya and Square
- BCM VOIP EPON二层链路状态改变分析
- poj2185 KMP求字符串循环节