## 计算机代写|算法作业代写Algorithm代考|CS515

statistics-lab™ 为您的留学生涯保驾护航 在代写算法Algorithm方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写算法Algorithm代写方面经验极为丰富，各种代写算法Algorithm相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

As a prototypical example of a sequence of instructions that is not actually an algorithm, consider “Martin’s algorithm”: ${ }^{16}$ Pretty simple, except for that first step; it’s a doozy! A group of billionaire CEOs, Silicon Valley venture capitalists, or New York City real-estate hustlers might consider this an algorithm, because for them the first step is both unambiguous and trivial, ${ }^{17}$ but for the rest of us poor slobs, Martin’s procedure is too vague to be considered an actual algorithm. On the other hand, this is a perfect example of a reduction-it reduces the problem of being a millionaire and never paying taxes to the “easier” problem of acquiring a million dollars. We’ll see reductions over and over again in this book. As hundreds of businessmen and politicians have demonstrated, if you know how to solve the easier problem, a reduction tells you how to solve the harder one.

Martin’s algorithm, like some of our previous examples, is not the kind of algorithm that computer scientists are used to thinking about, because it is phrased in terms of operations that are difficult for computers to perform. This book focuses (almost!) exclusively on algorithms that can be reasonably implemented on a standard digital computer. Each step in these algorithms is either directly supported by common programming languages (such as arithmetic, assignments, loops, or recursion) or something that you’ve already learned how to do (like sorting, binary search, tree traversal, or singing ” $n$ Bottles of Beer on the Wall”).

## 计算机代写|算法作业代写Algorithm代考|Describing Algorithms

The skills required to effectively design and analyze algorithms are entangled with the skills required to effectively describe algorithms. At least in my classes, a complete description of any algorithm has four components:

• What: A precise specification of the problem that the algorithm solves.
• How: A precise description of the algorithm itself.
• Why: A proof that the algorithm solves the problem it is supposed to solve.
• How fast: An analysis of the running time of the algorithm.
It is not necessary (or even advisable) to develop these four components in this particular order. Problem specifications, algorithm descriptions, correctness proofs, and time analyses usually evolve simultaneously, with the development of each component informing the development of the others. For example, we may need to tweak the problem description to support a faster algorithm, or modify the algorithm to handle a tricky casc in the proof of correctncss. Nevertheless, presenting these components separately is usually clearest for the reader.

As with any writing, it’s important to aim your descriptions at the right audience; I recommend writing for a competent but skeptical programmer who is not as clever as you are. Think of yourself six months ago. As you develop any new algorithm, you will naturally build up lots of intuition about the problem and about how your algorithm solves it, and your informal reasoning will be guided by that intuition. But anyone reading your algorithm later, or the code you derive from it, won’t share your intuition or experience. Neither will your compiler. Neither will you six months from now. All they will have is your written description.

Even if you never have to explain your algorithms to anyone else, it’s still important to develop them with an audience in mind. Trying to communicate clearly forces you to think more clearly. In particular, writing for a novice audience, who will interpret your words exactly as written, forces you to work through fine details, no matter how “obvious” or “intuitive” your high-level ideas may seem at the moment. Similarly, writing for a skeptical audience forces you to develop robust arguments for correctness and efficiency, instead of trusting your intuition or your intelligence. ${ }^{18}$

I cannot emphasize this point enough: Your primary job as an algorithm designer is teaching other people how and why your algorithms work. If you can’t communicate your ideas to other human beings, they may as well not exist. Producing correct and efficient executable code is an important but secondary goal. Convincing yourself, your professors, your (prospective) employers, your colleagues, or your students that you are smart is at best a distant third.

# 算法代考

Martin 的算法，就像我们之前的一些例子一样，不是计算机科学家习惯思考的那种算法，因为它是用计算机难以执行的操作来表述的。本书（几乎！）专注于可以在标准数字计算机上合理实现的算法。这些算法中的每一步要么由通用编程语言直接支持（例如算术、赋值、循环或递归），要么是您已经学会如何做的事情（例如排序、二分搜索、树遍历或唱歌）n墙上的啤酒瓶”）。

## 计算机代写|算法作业代写Algorithm代考|Describing Algorithms

• 什么：算法解决的问题的精确说明。
• 如何：算法本身的精确描述。
• 为什么：算法解决了它应该解决的问题的证明。
• 多快：分析算法的运行时间。
没有必要（甚至不建议）按此特定顺序开发这四个组件。问题规范、算法描述、正确性证明和时间分析通常同时发展，每个组件的发展都会影响其他组件的发展。例如，我们可能需要调整问题描述以支持更快的算法，或者修改算法以处理 correctncss 证明中的棘手 casc。然而，单独呈现这些组件通常对读者来说是最清楚的。

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 计算机代写|算法作业代写Algorithm代考|CS6515

statistics-lab™ 为您的留学生涯保驾护航 在代写算法Algorithm方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写算法Algorithm代写方面经验极为丰富，各种代写算法Algorithm相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 计算机代写|算法作业代写Algorithm代考|Compass and Straightedge

Classical Greek geometers identified numbers (or more accurately, magnitudes) with line segments of the appropriate length, which they manipulated using two simple mechanical tools – the compass and the straightedge-versions of which had already been in common use by surveyors, architects, and other artisans for centuries. Using only these two tools, these scholars reduced several complex geometric constructions to the following primitive operations, starting with one or more identified reference points.

• Draw the unique line passing through two distinct identified points.
• Draw the unique circle centered at one identified point and passing through another.
• Identify the intersection point (if any) of two lines.
• Identify the intersection points (if any) of a line and a circle.
• Identify the intersection points (if any) of two circles.
In practice, Greek geometry students almost certainly drew their constructions on an $a b a x(a ̆ \beta a \xi)$, a table covered in dust or sand. ${ }^{11}$ Centuries earlier, Egyptian surveyors carried out many of the same constructions using ropes to determine straight lines and circles on the ground. ${ }^{12}$ However, Euclid and other Greek geometers presented compass and straightedge constructions as precise mathematical abstractions-points are ideal points; lines are ideal lines; and circles are ideal circles.

Figure $0.4$ shows an algorithm, described in Euclid’s Elements about 2500 years ago, for multiplying or dividing two magnitudes. The input consists of four distinct points $A, B, C$, and $D$, and the goal is to construct a point $Z$ such that $|A Z|=|A C||A D| /|A B|$. In particular, if we define $|A B|$ to be our unit of length, then the algorithm computes the product of $|A C|$ and $|A D|$.

Notice that Euclid first defines a new primitive operation RIGHTANGLE by (as modern programmers would phrase it) writing a subroutine. The correctness of the algorithm follows from the observation that triangles $A C E$ and $A Z F$ are similar. The second and third lines of the main algorithm are ambiguous, because $\alpha$ intersects any circle centered at $A$ at $t w o$ distinct points, but the algorithm is actually correct no matter which intersection points are chosen for $E$ and $F$.

Euclid’s algorithm reduces the problem of multiplying two magnitudes (lengths) to a series of primitive compass-and-straightedge operations. These operations are difficult to implement precisely on a modern digital computer, but Euclid’s algorithm wasn’t designed for a digital computer. It was designed for the Platonic Ideal Geometer, wielding the Platonic Ideal Compass and the Platonic Ideal Straightedge, who could execute each operation perfectly in constant time by definition. In this model of computation, MultiplyOrDividE runs in $O(1)$ time!

## 计算机代写|算法作业代写Algorithm代考|Congressional Apportionment

Here is another real-world example of an algorithm of significant political importance. Article I, Section 2 of the United States Constitution requires that
Representatives and direct Taxes shall be apportioned among the several States which may be included within this Union, according to their respective Numbers…. The Number of Representatives shall not exceed one for every thirty Thousand, but each State shall have at Least one Representative….
Because there are only a finite number of seats in the House of Representatives, exact proportional representation requires either shared or fractional representatives, neither of which are legal. As a result, over the next several decades, many different apportionment algorithms were proposed and used to round the ideal fractional solution fairly. The algorithm actually used today, called the Huntington-Hill method or the method of equal proportions, was first suggested by Census Bureau statistician Joseph Hill in 1911, refined by Harvard mathematician Edward Huntington in 1920, adopted into Federal law (2 U.S.C. §2a) in 1941, and survived a Supreme Court challenge in $1992 .{ }^{13}$

The Huntington-Hill method allocates representatives to states one at a time. First, in a preprocessing stage, each state is allocated one representative. Then in each iteration of the main loop, the next representative is assigned to the state with the highest priority. The priority of each state is defined to be $P / \sqrt{r(r+1)}$, where $P$ is the state’s population and $r$ is the number of representatives already allocated to that state.

The algorithm is described in pseudocode in Figure 0.5. The input consists of an array Pop $[1 \ldots n]$ storing the populations of the $n$ states and an integer $R$ equal to the total number of representatives; the algorithm assumes $R \geq n$. (Currently, in the United States, $n=50$ and $R=435$.) The output array Rep $[1 \ldots n]$ records the number of representatives allocated to each state.

# 算法代考

## 计算机代写|算法作业代写Algorithm代考|Compass and Straightedge

• 绘制通过两个不同的识别点的唯一线。
• 绘制以一个已识别点为中心并穿过另一个点的唯一圆。
• 确定两条线的交点（如果有）。
• 确定直线和圆的交点（如果有）。
• 确定两个圆的交点（如果有）。
在实践中，希腊几何学生几乎肯定会在一个一个b一个X(一个̆b一个X)，布满灰尘或沙子的桌子。11几个世纪前，埃及测量员进行了许多相同的施工，使用绳索确定地面上的直线和圆圈。12然而，欧几里德和其他希腊几何学家将圆规和直尺结构作为精确的数学抽象——点是理想点；线条是理想的线条；圆是理想的圆。

## 计算机代写|算法作业代写Algorithm代考|Congressional Apportionment

Huntington-Hill 方法将代表一次分配给一个州。首先，在预处理阶段，每个状态分配一个代表。然后在主循环的每次迭代中，下一个代表被分配给具有最高优先级的状态。每个状态的优先级定义为P/r(r+1)， 在哪里P是国家的人口和r是已经分配给该州的代表人数。

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 计算机代写|算法作业代写Algorithm代考|CS120

statistics-lab™ 为您的留学生涯保驾护航 在代写算法Algorithm方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写算法Algorithm代写方面经验极为丰富，各种代写算法Algorithm相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 计算机代写|算法作业代写Algorithm代考|Lattice Multiplication

The most familiar method for multiplying large numbers, at least for American students, is the lattice algorithm. This algorithm was popularized by Fibonacci in Liber Abaci, who learned it from Arabic sources including al-Khwārizmī, who in turn learned it from Indian sources including Brahmagupta’s 7th-century treatise Brāhmasphuṭasiddhānta, who may have learned it from Chinese sources. The oldest surviving descriptions of the algorithm appear in The Mathematical Classic of Sunzi, written in China between the 3rd and 5 th centuries, and in Eutocius of Ascalon’s commentaries on Archimedes’ Measurement of the Circle, written around 50ocE, but there is evidence that the algorithm was known much earlier. Eutocius credits the method to a lost treatise of Apollonius of Perga, recorded multiplication tables on clay tablets as early as 2600 . that they may have used the lattice algorithm. ${ }^8$

The lattice algorithm assumes that the input numbers are represented as explicit strings of digits; I’ll assume here that we’re working in base ten, but the algorithm generalizes immediately to any other base. To simplify notation, ${ }^9$ the input consists of a pair of arrays $X[0 \ldots m-1]$ and $Y[0 \ldots n-1]$, representing the numbers
$$x=\sum_{i=0}^{m-1} X[i] \cdot 10^i \text { and } y=\sum_{j=0}^{n-1} Y[j] \cdot 10^j \text {, }$$
and similarly, the output consists of a single array $Z[0 . . m+n-1]$, representing the product
$$z=x \cdot y=\sum_{k=0}^{m+n-1} Z[k] \cdot 10^k .$$
The algorithm uses addition and single-digit multiplication as primitive operations. Addition can be performed using a simple for-loop. In practice, single-digit multiplication is performed using a lookup table, either carved into clay tablets, painted on strips of wood or bamboo, written on paper, stored in read-only memory, or memorized by the computator. The entire lattice algorithm can be summarized by the formula
$$x \cdot y=\sum_{i=0}^{m-1} \sum_{j=0}^{n-1}\left(X[i] \cdot Y[j] \cdot 10^{i+j}\right) .$$
Different variants of the lattice algorithm evaluate the partial products $X[i]$. $Y[j] \cdot 10^{i+j}$ in different orders and use different strategies for computing their sum. For example, in Liber Abaco, Fibonacci describes a variant that considers the $m n$ partial products in increasing order of significance, as shown in modern pseudocode below.

## 计算机代写|算法作业代写Algorithm代考|Duplation and Mediation

The lattice algorithm is not the oldest multiplication algorithm for which we have direct recorded evidence. An even older and arguably simpler algorithm, which does not rely on place-value notation, is sometimes called Russian peasant multiplication, Ethiopian peasant multiplication, or just peasant multiplication.

variant of this algorithm was copied into the Rhind papyrus by the Egyptian scribe Ahmes around 1650всЕ, from a document he claimed was (then) about 350 years old. ${ }^{10}$ This algorithm was still taught in elementary schools in Eastern Europe in the late 20 th century; it was also commonly used by early digital computers that did not implement integer multiplication directly in hardware.
The peasant multiplication algorithm reduces the difficult task of multiplying arbitrary numbers to a sequence of four simpler operations: (1) determining parity (even or odd), (2) addition, (3) duplation (doubling a number), and (4) mediation (halving a number, rounding down).

The correctness of this algorithm follows by induction from the following recursive identity, which holds for all non-negative integers $x$ and $y$ :
$$x \cdot y= \begin{cases}0 & \text { if } x=0 \ \lfloor x / 2\rfloor \cdot(y+y) & \text { if } x \text { is even } \ \lfloor x / 2\rfloor \cdot(y \mid y) \mid y & \text { if } x \text { is odd }\end{cases}$$
Arguably, this recurrenee is the pensant multiplieation algorithm. Don’t let the iterative pseudocode fool you; the algorithm is fundamentally recursive!

As stated, PeasantMultiply performs $O(\log x)$ parity, addition, and mediation operations, but we can improve this bound to $O(\log \min {x, y})$ by swapping the two arguments when $x>y$. Assuming the numbers are represented using any reasonable place-value notation (like binary, decimal, Babylonian hexagesimal, Egyptian duodecimal, Roman numeral, Chinese counting rods, head positions on an abacus, and so on), each operation requires at most $O(\log (x y))=O(\log \max {x, y})$ single-digit operations, so the overall running time of the algorithm is $O(\log \min {x, y} \cdot \log \max {x, y})=O(\log x \cdot \log y)$.

# 算法代考

## 计算机代写|算法作业代写Algorithm代考|Lattice Multiplication

$$x=\sum_{i=0}^{m-1} X[i] \cdot 10^i \text { and } y=\sum_{j=0}^{n-1} Y[j] \cdot 10^j$$

$$z=x \cdot y=\sum_{k=0}^{m+n-1} Z[k] \cdot 10^k .$$

$$x \cdot y=\sum_{i=0}^{m-1} \sum_{j=0}^{n-1}\left(X[i] \cdot Y[j] \cdot 10^{i+j}\right) .$$

## 计算机代写|算法作业代写Algorithm代考|Duplation and Mediation

$x \cdot y={0 \quad$ if $x=0\lfloor x / 2\rfloor \cdot(y+y) \quad$ if $x$ is even $\lfloor x / 2\rfloor \cdot(y \mid y) \mid y \quad$ if $x$ is odd

$O(\log \min x, y \cdot \log \max x, y)=O(\log x \cdot \log y)$

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 计算机代写|算法作业代写Algorithm代考|CSE421

statistics-lab™ 为您的留学生涯保驾护航 在代写算法Algorithm方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写算法Algorithm代写方面经验极为丰富，各种代写算法Algorithm相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 计算机代写|算法作业代写Algorithm代考|Amortized Analysis w

• $t_i=$ actual time for the $\mathrm{i}^{\text {th }}$ operation.
• $\Phi_i=$ potential after $i^{\text {th }}$ operation.
• $a_i=t_i+\left(\Phi_i-\Phi_{i-1}\right)$ amortized time for $i^{\text {th }}$ oper. actual time net increase in potential
• Why it’s useful:
\begin{aligned} \sum_{1 \leq i \leq n} a_i & =\sum_{1 \leq i \leq n}\left(t_i+\Phi_i-\Phi_{i-1}\right) \ & =\sum_{1 \leq i \leq n} t_i+\left(\Phi_n-\Phi_0\right) \end{aligned}
• Binary search tree Review:
• Stores ordered set $S$ of keys: one node per key.
• An in-order traversal of the tree lists the keys in sorted order
• Supports many operations:
• insert(x): $\quad S:=S \cup{x}$
• delete $(x): S:=S \backslash{x}$
• $\operatorname{lookup}(x): \quad x \in S$ ?
• $\operatorname{pred}(x): \max {y \in S \mid y \leq x}$
• $\operatorname{succ}(x): \min {y \in S \mid y>x}$
• …and others.

## 计算机代写|算法作业代写Algorithm代考|Binary Search Trees

• Binary search tree Review:
• Stores ordered set $\mathrm{S}$ of keys: one node per key.
• An in-order traversal of the tree lists the keys in sorted order
• Supports many operations:
• insert(x): $\quad S:=S \cup{x}$
• delete(x): $S:=S \backslash{x}$
• $\operatorname{lookup}(x): \quad x \in S$ ?
• $\operatorname{pred}(x): \max {y \in S \mid y \leq x}$
• $\operatorname{succ}(x): \min {y \in S \mid y>x}$
• …and others.
• A balanced search tree may not be optimal!
• An extreme example: keys 1,2,3,4,5,..,16
• Probability of accessing $1=1 / 2$
• Prob. for $2=1 / 4$
• Prob. for $3=1 / 8$
$-\ldots$
• Prob for $15,16=(1 / 2)^{15}$
• The optimal search tree is very unbalanced

# 算法代考

## 计算机代写|算法作业代写Algorithm代考|Amortized Analysis w

• $t_i=$ 的实际时间 $\mathrm{i}^{\text {th }}$ 手术。
• $\Phi_i=$ 之后的潜力 $i^{\text {th }}$ 手术。
• $a_i=t_i+\left(\Phi_i-\Phi_{i-1}\right)$ 倠销时间 $i^{\text {th }}$ 操作。实际时间净增加潜力
• 为什么有用:
$$\sum_{1 \leq i \leq n} a_i=\sum_{1 \leq i \leq n}\left(t_i+\Phi_i-\Phi_{i-1}\right) \quad=\sum_{1 \leq i \leq n} t_i+\left(\Phi_n-\Phi_0\right)$$
• 二叉搜索树回顾:
• 存储有序集 $S$ 键数：每个键一个节点。
• 树的有序遍历按排序顺序列出键
• 支持多种操作:
• 揷入 (x) : $S:=S \cup x$
• 删除 $(x): S:=S \backslash x$
• $\operatorname{lookup}(x): \quad x \in S$ ?
• $\operatorname{pred}(x): \max y \in S \mid y \leq x$
• $\operatorname{succ}(x): \min y \in S \mid y>x$
• …和别的。

## 计算机代写|算法作业代写Algorithm代考|Binary Search Trees

• 二叉搜索树回顾:
• 存储有序集S键数：每个键一个节点。
• 树的有序谝历按排序顺序列出键
• 支持多种操作:
• 揷入 (x) : $S:=S \cup x$
• 删除 (x) : $S:=S \backslash x$
• $\operatorname{lookup}(x): \quad x \in S$ ?
• $\operatorname{pred}(x): \max y \in S \mid y \leq x$
• $\operatorname{succ}(x): \min y \in S \mid y>x$
• …和别的。
• 平衡的搜索树可能不是最优的!
• 一个极端的例子：按键 $1,2,3,4,5, \ldots, 16$
• 访问概率 $1=1 / 2$
• 概率。为了 $2=1 / 4$
• 概率。为了 $3=1 / 8$
• 概率 $15,16=(1 / 2)^{15}$
• 最优搜索树很不平衡

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 计算机代写|算法作业代写Algorithm代考|CS515

statistics-lab™ 为您的留学生涯保驾护航 在代写算法Algorithm方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写算法Algorithm代写方面经验极为丰富，各种代写算法Algorithm相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 计算机代写|算法作业代写Algorithm代考|Shortest Paths

• $G=(V, E, \ell), n=|V|, \quad m=|E|, \quad \ell: E \rightarrow \mathbb{R}$.
• APSP (All Pairs Shortest Paths)
$-O\left(n^3 \log n\right)$ – Path Doubling Algorithm
$-O\left(n^3\right)-$ Floyd-Warshall algorithm
$-O\left(m n+n^2 \log n\right)-n \times$ Dijkstra
$-O\left(m n+n^2 \log \log n\right)-$ [Pettie 2002]
• SSSP (Single Source Shortest Paths)
• $O(m n)-$ Bellman-Ford algorithm
$-O(m \sqrt{n} \log C)-[$ Goldberg 1995] $\ell: E \rightarrow{-C, \ldots, C}$.
$-O\left(m \log ^8 n \log C\right)-[$ Bernstein, Nanongkai, Wulff-Nilsen 2022$]$
• $\operatorname{SSSP}^{+}\left(\ell: E \rightarrow \mathbb{R}^{+} \cup{0}\right)$
FOcs 2022
$-O(m+n \log n)-$ Dijkstra’s algorithm + Fibonacci Heaps
• Given directed graph $G=(V, E)$ with $\ell: E \rightarrow \mathbb{R}^{+} \cup{0}$ and a source $s \in V$, compute $\operatorname{dist}(s, v)$ for every $v \in V$.
• Key observation: list vertices in increasing distance from the source: $\left{s=v_0, v_1, v_2, \ldots, v_{n-1}\right}$. The shortest $v_0-v_i$ path only uses intermediate vertices from $\left{v_1, \ldots, v_{i-1}\right}$

## 计算机代写|算法作业代写Algorithm代考|Dijkstra’s shortest path algorithm

• Dijkstra’s algorithm:
• LOOP INVARIANT:
• If $v \in S$ then $d(v)=\operatorname{dist}(s, v)$
• If $v \notin S$ then $d(v)=\operatorname{dist}_S(S, v)$
• Initialization: $S:=\emptyset ; d(s):=0 ; d(v):=\infty$ for all $v \neq s$.
• Repeat until all vertices are in $S$ : Insert all vertices in a priority
• Find the $v \notin S$ with minimum $d(v)$ queue, keyed by $\mathrm{d}(\mathrm{)}$
• $S:=S \cup{v}$
Deletemin from priority queue
• “Relax” each outgoing edge $(v, u) \in E$ $-d(u):=\min {d(u), d(v)+\ell(v, u)} \leftarrow$ Perform decreasekey on u.
• Return $d$
• Maintain a set $Q$ (initially empty)
• Each element $x \in Q$ has a key $d(x)$
• Binary heaps do all operations in $O(\log n)$ time
• Fibonacci heaps are optimal in an amortized sense.

# 算法代考

## 计算机代写|算法作业代写Algorithm代考|Shortest Paths

• $G=(V, E, \ell), n=|V|, \quad m=|E|, \quad \ell: E \rightarrow \mathbb{R}$.
• APSP (所有对最短路径) $-O\left(n^3 \log n\right)-$ 路径加倍算法
$-O\left(n^3\right)-$ 弗洛伊德沃歇尔算法
$-O\left(m n+n^2 \log n\right)-n \times$ 迪克斯特拉
$-O\left(m n+n^2 \log \log n\right)-[$ 佩蒂 2002]
• SSSP (单源最短路径)
• $O(m n)$-贝尔曼-福特算法
$-O(m \sqrt{n} \log C)-[$ 戈德堡 1995] $\ell: E \rightarrow-C, \ldots, C$.
$-O\left(m \log ^8 n \log C\right)-$ [Bernstein, Nanongkai, Wulff-Nilsen 2022]
• $\operatorname{SSSP}^{+}\left(\ell: E \rightarrow \mathbb{R}^{+} \cup 0\right)$
福克斯 2022
$-O(m+n \log n)-$ Dijkstra 算法 + 斐波那契堆
• 给定有向图 $G=(V, E)$ 和 $\ell: E \rightarrow \mathbb{R}^{+} \cup 0$ 和一个来源 $s \in V$, 计算dist $(s, v)$ 每一个 $v \in V$.

## 计算机代写|算法作业代写Algorithm代考|Dijkstra’s shortest path algorithm

• Dijkstra 算法:
• 循环不变量:
• 如果 $v \in S$ 然后 $d(v)=\operatorname{dist}(s, v)$
• 如果 $v \notin S$ 然后 $d(v)=\operatorname{dist}_S(S, v)$
• 初始化: $S:=\emptyset ; d(s):=0 ; d(v):=\infty$ 对所有人 $v \neq s$.
• 重复直到所有顶点都在 $S:$ : 优先揷入所有顶点
• 找出 $v \notin S$ 最低限度 $d(v)$ 队列，键控d ()
• $S:=S \cup v$
从优先队列中删除min
• “放松”每个传出边 $(v, u) \in E-d(u):=\min d(u), d(v)+\ell(v, u) \leftarrow$ 对你执行 decreasekey。
• 返回 $d$
• 维护一套 $Q$ (最初为空)
• 每个元素 $x \in Q$ 有一把钥匙 $d(x)$
• 二进制堆执行所有操作 $O(\log n)$ 时间
• 斐波那契堆在摊销意义上是最优的。

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 计算机代写|算法作业代写Algorithm代考|CS6515

statistics-lab™ 为您的留学生涯保驾护航 在代写算法Algorithm方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写算法Algorithm代写方面经验极为丰富，各种代写算法Algorithm相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 计算机代写|算法作业代写Algorithm代考|Multiple Matrix Multiplication

• Matrix multiplication is associative but not commutative
$$-A(B C)=(A B) C$$
$-A B \neq B A$ (not necessarily equal)
• Cost of mult. $m \times p$ and $p \times n$ matrices is $O(m n p)$.
• The Problem:
• Given matrices $A_1, A_2, \ldots, A_k$
$-A_i$ is an $n_i \times n_{i+1}$ matrix where $n_1, \ldots, n_{k+1}$ are ints.
• Compute $A_1 A_2 \cdots A_k$ via a sequence of matrix mults.
$-\left(A_1 A_2 \cdots A_k\right)$ is an $n_1 \times n_{k+1}$ matrix
• Input: Given sequence $\left(k_j\right)_{1 \leq j \leq n}$
• Keys in sorted order: $k_1<k_2<\cdots<k_n$
$-p_j=$ probability of searching for key $k_j$
• “Dummy keys” $d_0<d_1<\cdots<d_n$
$-q_j$ = probability of searching for $d_j$ (searching in $\left.\left(k_j, k_{j+1}\right)\right)$
$-\Sigma_j p_j+\Sigma_j q_j=1$
• Problem: design an optimal binary search tree that minimizes expected search time
$-\operatorname{depth}_T\left(k_j\right)=$ depth of $k_j$ in tree $T$
• Search time for $k_j=\operatorname{depth}_T\left(k_j\right)+1$
• Expected search time in $T$ is…?

## 计算机代写|算法作业代写Algorithm代考|The Obvious Algorithm

• Brute Force Search:
• Calculate expected search time on all possible trees
• Roughly $4^n$ rooted binary trees on $\mathrm{n}$ nodes
• How can we search for the optimum tree more efficiently?
• $w(i, j)$ : the total probability mass in a subtree containing $k_i, \ldots, k_j$, i.e., $q_{i-1}+p_i+\cdots+p_j+q_j$. $-w(i, i-1)=q_{i-1}$.
$-w(i, j)=w(i, j-1)+p_j+q_j$.
• $e(i, j):$ expected number of nodes $\left{k_i, \ldots, k_j\right}$ touched in a search, if $\left{k_i, \ldots, k_j\right}$ are arranged optimally in a subtree.
$-e(i, i-1)=w(i, i-1)=q_{i-1}$.
$-e(i, j)=\min _{i \leq r \leq j}{e(i, r-1)+e(r+1, j)+w(i, j)}$
$-\operatorname{root}(i, j)=$ the ” $r$ ” minimizing the eqn. above.
• Theorem (Knuth). $\operatorname{root}(i, j-1) \leq \operatorname{root}(i, j) \leq \operatorname{root}(i+1, j)$.
• Old recursive formulation:
$$e(i, j)=\min _{i \leq r \leq j}{e(i, r-1)+e(r+1, j)+w(i, j)}$$
• Equally good recursive formulation:
\begin{aligned} & e(i, j)=\min _{\operatorname{root}(i, j-1) \leq r \leq \operatorname{root}(i+1, j)} \ & {e(i, r-1)+e(r+1, j)+w(i, j)} \ & \end{aligned}

# 算法代考

## 计算机代写|算法作业代写Algorithm代考|Multiple Matrix Multiplication

• 矩阵乘法是结合的但不是可交换的
$$-A(B C)=(A B) C$$
$-A B \neq B A$ (不一定相等)
• 多的成本。 $m \times p$ 和 $p \times n$ 矩阵是 $O(m n p)$.
• 问题:
• 给定矩阵 $A_1, A_2, \ldots, A_k$ $-A_i$ 是一个 $n_i \times n_{i+1}$ 矩阵其中 $n_1, \ldots, n_{k+1}$ 是整数。
• 计算 $A_1 A_2 \cdots A_k$ 通过一系列矩阵 mults。 $-\left(A_1 A_2 \cdots A_k\right)$ 是一个 $n_1 \times n_{k+1}$ 矩阵
• 输入：给定序列 $\left(k_j\right)_{1 \leq j \leq n}$
• 按排序顺序排列的键: $k_1<k_2<\cdots<k_n$ $-p_j$ =搜索密钥的概率 $k_j$
• “虚拟钥匙” $d_0<d_1<\cdots<d_n$ $-q_j$ = 搜索概率 $d_j \quad\left(\right.$ 搜索 $\left.\left(k_j, k_{j+1}\right)\right)$
$$-\Sigma_j p_j+\Sigma_j q_j=1$$
• 问题: 设计一个最优二叉搜索树，使预期搜索时间最小化 $-\operatorname{depth}_T\left(k_j\right)=$ 的深度 $k_j$ 在树上 $T$
• 搜索时间 $k_j=\operatorname{depth}_T\left(k_j\right)+1$
• 预计搜索时间 $T$ 是…?

## 计算机代写|算法作业代写Algorithm代考|The Obvious Algorithm

• 暴力搜索:
• 计算所有可能树的预期搜索时间
• 大致 $4^n$ 有根二叉树 $n$ 节点
• 我们如何才能更有效地搜索最优树?
• $w(i, j)$ : 子树中的总概率质量包含 $k_i, \ldots, k_j$ ，那是， $q_{i-1}+p_i+\cdots+p_j+q_j$. $-w(i, i-1)=q_{i-1}$.
$-w(i, j)=w(i, j-1)+p_j+q_j$ 排列在子树中。
$-e(i, i-1)=w(i, i-1)=q_{i-1}$.
$-e(i, j)=\min _{i \leq r \leq j} e(i, r-1)+e(r+1, j)+w(i, j)$
$-\operatorname{root}(i, j)=$ 这 ” $r$ ” 最小化方程式。以上。
• 定理 (Knuth) 。 $\operatorname{root}(i, j-1) \leq \operatorname{root}(i, j) \leq \operatorname{root}(i+1, j)$
• 旧的递归公式:
$$e(i, j)=\min _{i \leq r \leq j} e(i, r-1)+e(r+1, j)+w(i, j)$$
• 同样好的递归公式:
$$e(i, j)=\min _{\operatorname{root}(i, j-1) \leq r \leq \operatorname{root}(i+1, j)} e(i, r-1)+e(r+1, j)+w(i, j)$$

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 计算机代写|算法分析作业代写Introduction to Algorithms代考|CSE421

statistics-lab™ 为您的留学生涯保驾护航 在代写算法分析Introduction to Algorithms方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写算法分析Introduction to Algorithms代写方面经验极为丰富，各种代写算法分析Introduction to Algorithms相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 计算机代写|算法分析作业代写Introduction to Algorithms代考|Hash Tables

Many applications require a dynamic set that supports only the dictionary operations INSERT, SEARCH, and DELETE. For example, a compiler that translates a programming language maintains a symbol table, in which the keys of elements are arbitrary character strings corresponding to identifiers in the language. A hash table is an effective data structure for implementing dictionaries. Although searching for an element in a hash table can take as long as searching for an element in a linked list $-\Theta(n)$ time in the worst case-in practice, hashing performs extremely well. Under reasonable assumptions, the average time to search for an element in a hash table is $O(1)$. Indeed, the built-in dictionaries of Python are implemented with hash tables.

A hash table generalizes the simpler notion of an ordinary array. Directly addressing into an ordinary array takes advantage of the $O(1)$ access time for any array element. Section $11.1$ discusses direct addressing in more detail. To use direct addressing, you must be able to allocate an array that contains a position for every possible key.

When the number of keys actually stored is small relative to the total number of possible keys, hash tables become an effective alternative to directly addressing an array, since a hash table typically uses an array of size proportional to the number of keys actually stored. Instead of using the key as an array index directly, we compute the array index from the key. Section $11.2$ presents the main ideas, focusing on “chaining” as a way to handle “collisions,” in which more than one key maps to the same array index. Section $11.3$ describes how to compute array indices from keys using hash functions. We present and analyze several variations on the basic theme. Section $11.4$ looks at “open addressing,” which is another way to deal with collisions. The bottom line is that hashing is an extremely effective and practical technique: the basic dictionary operations require only $O(1)$ time on the average. Section $11.5$ discusses the hierarchical memory systems of modern computer systems have and illustrates how to design hash tables that work well in such systems.

Direct addressing is a simple technique that works well when the universe $U$ of keys is reasonably small. Suppose that an application needs a dynamic set in which each element has a distinct key drawn from the universe $U={0,1, \ldots, m-1}$, where $m$ is not too large.

To represent the dynamic set, you can use an array, or direct-address table, denoted by $T[0: m-1]$, in which each position, or slot, corresponds to a key in the universe $U$. Figure $11.1$ illustrates this approach. Slot $k$ points to an element in the set with key $k$. If the set contains no element with key $k$, then $T[k]=$ NIL.

The dictionary operations DIRECT-ADDRESS-SEARCH, DIRECT-ADDRESS-INSERT, and DIRECT-ADDRESS-DELETE on the following page are trivial to implement. Each takes only $O(1)$ time.

For some applications, the direct-address table itself can hold the elements in the dynamic set. That is, rather than storing an element’s key and satellite data in an object external to the direct-address table, with a pointer from a slot in the table to the object, save space by storing the object directly in the slot. To indicate an empty slot, use a special key. Then again, why store the key of the object at all? The index of the object is its key! Of course, then you’d need some way to tell whether slots are empty.

# 算法分析代考

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 计算机代写|算法分析作业代写Introduction to Algorithms代考|CS515

statistics-lab™ 为您的留学生涯保驾护航 在代写算法分析Introduction to Algorithms方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写算法分析Introduction to Algorithms代写方面经验极为丰富，各种代写算法分析Introduction to Algorithms相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

A linked list is a data structure in which the objects are arranged in a linear order. Unlike an array, however, in which the linear order is determined by the array indices, the order in a linked list is determined by a pointer in each object. Since the elements of linked lists often contain keys that can be searched for, linked lists are sometimes called search lists. Linked lists provide a simple, flexible representation for dynamic sets, supporting (though not necessarily efficiently) all the operations listed on page 250 .

As shown in Figure 10.4, each element of a doubly linked list $L$ is an object with an attribute key and two pointer attributes: next and prev. The object may also contain other satellite data. Given an element $x$ in the list, $x$. next points to its successor in the linked list, and $x . p r e v$ points to its predecessor. If $x$.prev $=$ NIL, the element $x$ has no predecessor and is therefore the first element, or head, of the list. If $x$.next = NIL, the element $x$ has no successor and is therefore the last element, or tail, of the list. An attribute L.head points to the first element of the list. If L.head $=$ NIL , the list is empty.

A list may have one of several forms. It may be either singly linked or doubly linked, it may be sorted or not, and it may be circular or not. If a list is singly linked, each element has a next pointer but not a prev pointer. If a list is sorted, the linear order of the list corresponds to the linear order of keys stored in elements of the list. The minimum element is then the head of the list, and the maximum element is the tail. If the list is unsorted, the elements can appear in any order. In a circular list, the prev pointer of the head of the list points to the tail, and the next pointer of the tail of the list points to the head. You can think of a circular list as a ring of elements. In the remainder of this section, we assume that the lists we are working with are unsorted and doubly linked.

## 计算机代写|算法分析作业代写Introduction to Algorithms代考|Representing rooted trees

Linked lists work well for representing linear relationships, but not all relationships are linear. In this section, we look specifically at the problem of representing rooted trees by linked data structures. We first look at binary trees, and then we present a method for rooted trees in which nodes can have an arbitrary number of children.

We represent each node of a tree by an object. As with linked lists, we assume that each node contains a key attribute. The remaining attributes of interest are pointers to other nodes, and they vary according to the type of tree.

It’s simple to extend the scheme for representing a binary tree to any class of trees in which the number of children of each node is at most some constant $k$ : replace the left and right attributes by child $_1$, child $_2, \ldots$ , child $_k$. This scheme no longer works when the number of children of a node is unbounded, however, since we do not know how many attributes to allocate in advance. Moreover, if $k$, the number of children, is bounded by a large constant but most nodes have a small number of children, we may waste a lot of memory.

Fortunately, there is a clever scheme to represent trees with arbitrary numbers of children. It has the advantage of using only $O(n)$ space for any $n$-node rooted tree. The left-child, right-sibling representation appears in Figure 10.7. As before, each node contains a parent pointer $p$, and T.root points to the root of tree $T$. Instead of having a pointer to each of its children, however, each node $x$ has only two pointers:

1. $x$.left-child points to the leftmost child of node $x$, and
2. $x$.right-sibling points to the sibling of $x$ immediately to its right.
If node $x$ has no children, then $x$.left-child $=\mathrm{NIL}$, and if node $x$ is the rightmost child of its parent, then $x$. right-sibling $=$ NIL.

# 算法分析代考

## 计算机代写|算法分析作业代写Introduction to Algorithms代考|Representing rooted trees

1. X.left-child 指向节点最左边的孩子X， 和
2. X.right-sibling 指向的兄弟姐妹X立即在它的右边。
如果节点X没有孩子，那么X.left-child=否我大号, 如果节点X是其父母最右边的孩子，那么X. 右兄弟=零。

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 计算机代写|算法分析作业代写Introduction to Algorithms代考|CS6515

statistics-lab™ 为您的留学生涯保驾护航 在代写算法分析Introduction to Algorithms方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写算法分析Introduction to Algorithms代写方面经验极为丰富，各种代写算法分析Introduction to Algorithms相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 计算机代写|算法分析作业代写Introduction to Algorithms代考|Elementary Data Structures

We assume that, as in most programming languages, an array is stored as a contiguous sequence of bytes in memory. If the first element of an array has index $s$ (for example, in an array with 1-origin indexing, $s=1$ ), the array starts at memory address $a$, and each array element occupies $b$ bytes, then the $i$ th element occupies bytes $a+b(i-s)$ through $a+b(i-s$ $+1)-1$. Since most of the arrays in this book are indexed starting at 1 , and a few starting at 0 , we can simplify these formulas a little. When $s=$ 1 , the $i$ th element occupies bytes $a+b(i-1)$ through $a+b i-1$, and when $s=0$, the $i$ th element occupies bytes $a+b i$ through $a+b(i+1)-$ 1. Assuming that the computer can access all memory locations in the same amount of time (as in the RAM model described in Section 2.2), it takes constant time to access any array element, regardless of the index.
Most programming languages require each element of a particular array to be the same size. If the elements of a given array might occupy different numbers of bytes, then the above formulas fail to apply, since the element size $b$ is not a constant. In such cases, the array elements are usually objects of varying sizes, and what actually appears in each array element is a pointer to the object. The number of bytes occupied by a pointer is typically the same, no matter what the pointer references, so that to access an object in an array, the above formulas give the address of the pointer to the object and then the pointer must be followed to access the object itself.

## 计算机代写|算法分析作业代写Introduction to Algorithms代考|Matrices

We typically represent a matrix or two-dimensional array by one or more one-dimensional arrays. The two most common ways to store a matrix are row-major and column-major order. Let’s consider an $m \times n$ matrix – a matrix with $m$ rows and $n$ columns. In row-major order, the matrix is stored row by row, and in column-major order, the matrix is stored column by column. For example, consider the $2 \times 3$ matrix
$$M=\left(\begin{array}{lll} 1 & 2 & 3 \ 4 & 5 & 6 \end{array}\right) \text {. }$$
Row-major order stores the two rows 123 and 456 , whereas columnmajor order stores the three columns $14 ; 25$; and 36 .

Parts (a) and (b) of Figure $10.1$ show how to store this matrix using a single one-dimensional array. It’s stored in row-major order in part (a) and in column-major order in part (b). If the rows, columns, and the single array all are indexed starting at $s$, then $M[i, j]$-the element in row $i$ and column $j$-is at array index $s+(n(i-s))+(j-s)$ with row-major order and $s+(m(j-s))+(i-s)$ with column-major order. When $s=1$, the single-array indices are $n(i-1)+j$ with row-major order and $i$ $+m(j-1)$ with column-major order. When $s=0$, the single-array indices are simpler: $n i+j$ with row-major order and $i+m j$ with columnmajor order. For the example matrix $M$ with 1-origin indexing, element $M[2,1]$ is stored at index $3(2-1)+1=4$ in the single array using rowmajor order and at index $2+2(1-1)=2$ using column-major order.
Parts (c) and (d) of Figure $10.1$ show multiple-array strategies for storing the example matrix. In part (c), each row is stored in its own array of length $n$, shown in tan. Another array, with $m$ elements, shown in blue, points to the $m$ row arrays. If we call the blue array $A$, then $A[i]$ points to the array storing the entries for row $i$ of $M$, and array element $A[i][j]$ stores matrix element $M[i, j]$. Part (d) shows the column-major version of the multiple-array representation, with $n$ arrays, each of length $m$, representing the $n$ columns. Matrix element $M[i, j]$ is stored in array element $A[j][i]$.

Single-array representations are typically more efficient on modern machines than multiple-array representations. But multiple-array representations can sometimes be more flexible, for example, allowing for “ragged arrays,” in which the rows in the row-major version may have different lengths, or symmetrically for the column-major version, where columns may have different lengths.

# 算法分析代考

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。