Question 1 (25pt)
Given the input , track the divide-and-conquer algorithm to find the maximum contiguous subarray. You need to show the recursive calls as a tree. The input and output for each recursive call should also be indicated as well.
Question 2 (25pt)
Given two polynomials and , track the algorithm to calculate . You need to show the recursive calls as a tree. The input and output for each recursive call should also be indicated as well.
Question 3 (20pt)
In the deterministic linear-time divide-and-conquer algorithm taught in class for the selection problem, the input array is divided into groups of 5 elements. Analyze the running time of the algorithm if the input array is divided into groups of 7. Does your algorithm run in linear time?
Question 4 (15pt)
A segment is a pair of positive integers , where . Two segments and intersect if .
Given a sequence of segments sorted increasingly by ’s ( if ) within the ( for all ), design a divide-and-conquer algorithm to justify if there are two segments intersect.
You need to
a)Describe your algorithm in a high-level presentation. (5pt)
b)Write down the pseudo code. (5pt)
c)Analyze the time complexity of your algorithm. (5pt)
Question 5 (10pt)
In lecture 3, we studied the divide-and-conquer algorithm for the polynomial multiplication problem. To let polynomials evenly split into sub-polynomials, the algorithm on page 17 (Line 4 - 7) nicely considers all the cases and uses the ceiling function (the last term in is ).
However, Goliath is lazy. He does not want to use any ceiling function or floor function in his implementation. To make his life easy, he simply assumes that
“The number of terms in the polynomials is always an integer power of .”
In other words, for some .
But, the polynomial multiplication problem in general contains polynomials whose number of terms is not an integer power of 2. Thus, you need to
a)Define a method to convert polynomials in general to polynomials whose number of terms is an integer power of 2. (5pt)
b)Discuss the consequence by doing so. Does it increase the time complexity comparing to the original algorithm (Algorithm 2 on page 17 in lecture 03)? Why? (5pt)
(Hint: please pay attention to the input size)
Assume Goliath’s implementation has the interface . You can consider that the algorithm with Goliath’s implementation works as follows.
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- HGC环电强化国际业务领导架构 谭君骥及Ravindran Mahalingam分别担任专精职务
- 海伯森六维力传感器:助力人形机器人产业发展的创新力量
- 达闼董事长黄晓庆:以技术破局致胜从未止步
- 从辅助到核心,企业如何基于AI Agent升级品牌数字营销
- 国产2.5亿超高分辨率图像传感器发布,主要面向机器视觉领域
- 西部数据推出多款超高速、大容量存储解决方案
- 中关村e谷承办“科创耀未来 奋进谱新篇”企业家创新论坛圆满落幕
- 航科卫星“汕头数字一号”卫星发射成功!
- Gartner 最新魔力象限出炉!ManageEngine卓豪成功入围
- 科技重塑物流,英特尔&集和诚加速智慧物流发展!
- 数智赋能 向“新而行” 坦克与装甲车辆学术与发展论坛召开
- 赛诺威盛:大孔径专科化CT领航者
- 网易硬刚腾讯 两大游戏玩家之间的口水仗不断
- 全球“最独特”的一台华为 nova 6 5G 版手机是什么样子的?
- 拼多多抖音淘宝京东,谁是真低价?