联系我们: 手动添加方式: 微信>添加朋友>企业微信联系人>13262280223 或者 QQ: 1483266981
This unit will teach some powerful ideas that are central to solving algorithmic problems in ways that are more efficient than naive approaches. In particular, students will learn how data collections can support efficient access, for example, how a dictionary or map can allow key-based lookup that does not slow down linearly as the collection grows in size. The data structures covered in this unit include lists, stacks, queues, priority queues, search trees, hash tables, and graphs. Students will also learn efficient techniques for classic tasks such as sorting a collection. The concept of asymptotic notation will be introduced, and used to describe the costs of various data access operations and algorithms.
这是一份sydney悉尼大学DATA2002/DATA2902 的成功案例
数据结构和算法|COMP2123/COMP2823 Data Structures and Algorithms
问题 1.
Let p(n)=∑i=0kainip(n)= sum_{i=0}^{k} a_{i} n^{i} denote any polynomial and assume ak>0a_{k}>0. Then p(n)∈Θ(nk)p(n) in Theta left(n^{k} right).
证明 .
Proof. It suffices to show that p(n)∈O(nk)p(n) in mathrm{O} left(n^{k} right) and p(n)∈Ω(nk)p(n) in Omega left(n^{k} right). First observe that for n>0n>0,p(n)≤∑i=0k|ai|ni≤nk∑i=0k|ai| p(n) leq sum_{i=0}^{k} left|a_{i} right| n^{i} leq n^{k} sum_{i=0}^{k} left|a_{i} right| and hence p(n)≤(∑i=0k|ai|)nkp(n) leq left( sum_{i=0}^{k} left|a_{i} right| right) n^{k} for all positive nn. Thus p(n)∈O(nk)p(n) in mathrm{O} left(n^{k} right).Let A=∑i=0k?1|ai|A= sum_{i=0}^{k-1} left|a_{i} right|. For positive nn we havep(n)≥aknk?Ank?1=ak2nk+nk?1(ak2n?A) p(n) geq a_{k} n^{k}-A n^{k-1}= frac{a_{k}}{2} n^{k}+n^{k-1} left( frac{a_{k}}{2} n-A right) and hence p(n)≥(ak/2)nkp(n) geq left(a_{k} / 2 right) n^{k} for n>2A/akn>2 A / a_{k}. We choose c=ak/2c=a_{k} / 2 and n0=2A/akn_{0}=2 A / a_{k} in the definition of Ω(nk) Omega left(n^{k} right), and obtain p(n)∈Ω(nk)p(n) in Omega left(n^{k} right).
问题 2.
An arrangement is optimal with respect to the expected search cost if it has the property that pi>pjp_{i}>p_{j} implies ?ipjp_{i}>p_{j} and ?i>?j ell_{i}> ell_{j}, i.e., item ii is more probable than item jj and yet placed after it. Interchanging items ii and jj changes the search cost by?(pi?i+pj?j)+(pi?j+pj?i)=(pi?pj)(?i??j)<0 - left(p_{i} ell_{i}+p_{j} ell_{j} right)+ left(p_{i} ell_{j}+p_{j} ell_{i} right)= left(p_{i}-p_{j} right) left( ell_{i}- ell_{j} right)<0 i.e., the new arrangement is better and hence the old arrangement is not optimal. Let us now consider the case p1>p2>…>pnp_{1}>p_{2}> ldots>p_{n}. Since there are only n!n ! possible arrangements, there is an optimal arrangement. Also, if i


发表回复