Posted on Categories:Discrete Mathematics, 数学代写, 离散数学

avatest™

## avatest™帮您通过考试

avatest™的各个学科专家已帮了学生顺利通过达上千场考试。我们保证您快速准时完成各时长和类型的考试，包括in class、take home、online、proctor。写手整理各样的资源来或按照您学校的资料教您，创造模拟试题，提供所有的问题例子，以保证您在真实考试中取得的通过率是85%以上。如果您有即将到来的每周、季考、期中或期末考试，我们都能帮助您！

•最快12小时交付

•200+ 英语母语导师

•70分以下全额退款

An algorithmic paradigm is an abstraction higher than the notion of an algorithm. An algorithmic paradigm is a generic model, based on a particular approach, which underlies the design of a class of algorithms for solving a multitude of problems. Some of the important algorithmic paradigms are as follows:

Brute-force algorithms: The brute-force algorithm is a simple algorithm in concept that blindly iterates all possible solutions to search for one or more than one solution that may solve a problem without any regard to the heavy computational requirements. It takes an inefficient approach for solving problems, as it does not take advantage of the special structure of the problem. Examples include using all possible permutations of numbers to open a safe, finding the largest number in a list of numbers, sorting problems, such as the bubble, insertion, and selection sorts, and polling a multitude of communication devices to determine those having messages to transmit.

Divide-and-conquer algorithms: The divide-and-conquer algorithm is an effective algorithm that works by recursively breaking down a problem into two or more subproblems of the same or related type until these become simple enough to be solved directly and rather easily. The solutions to the subproblems are then combined to give a solution to the original problem. Examples include sorting problems, such as quicksort and merge sort, binary search, solving the closest pair problem, routing mail by sorting letters into separate bags for different geographical areas, and applying the law of total probability.

Backtracking algorithms: The backtracking algorithm incrementally builds candidates to the solution and abandons a candidate (i.e., backtracks) as soon as it determines that the candidate cannot possibly be a part of a valid solution. It is generally applied to find solutions to some constrained optimization problems. Examples include the eight queens puzzle, which asks for all arrangements of eight chess queens so that no queen attacks any other, crosswords, Sudoku, the knapsack problem, and finding spanning trees.

Dynamic programming: The dynamic programming algorithm can be effectively used for solving a complex problem by recursively breaking down the problem. It requires that overlapping subproblems exist, and the optimal solution of the problem can be obtained using optimal solutions of its subproblems stored in memory with the help of a recurrence relation. Examples include the scheduling problem, Fibonacci numbers, matrix chain multiplication, and the traveling salesman problem.

Probabilistic algorithms: The probabilistic algorithm can solve problems that cannot be easily solved by deterministic algorithms. In contrast to a deterministic algorithm, which always follows the same steps for a given input and has to go through a very large number of possible cases, the probabilistic algorithm makes some random choices at some steps, which may lead to different outputs in much fewer steps, but with a tiny probability that the final answer may not be correct. Examples include Monte Carlo algorithm in quality control, collisions in hashing functions, and Bayesian spam filters.

Greedy algorithms: The greedy algorithm is one of the simplest and most intuitive algorithms that is used in optimization problems, and it often leads to an optimal solution. The algorithm makes the optimal choice at each step as it attempts to find the minimum or maximum value of some parameter. Greedy algorithms sometimes fail to produce optimal solutions because they do not consider all the data, as the choice made by a greedy algorithm may depend on choices it has made so far, but it is not aware of future choices it could make. A greedy algorithm in a shortsighted manner identifies an optimal subproblem in the problem. With the goal of minimizing or maximizing the parameter of interest, create an iterative way to go through all of the subproblems so as to build a solution. Examples may include finding the shortest path through a graph and a Huffman code used in lossless digital compression of data.

## 数学代写|离散数学代写Discrete Mathematics代考|Complexity of Algorithms

The two main measures for the computational complexity of an algorithm are as follows:

Space complexity: It is measured by the maximum amount of computer memory needed in the execution of the algorithm, and the requirement is frequently a multiple of the data size.

Time complexity: It is measured by counting the number of key operations using the size of the input as its argument.
The term complexity generally refers to the running time of the algorithm. The function $f(n)$, representing the time complexity of an algorithm, is measured by the following two factors:
(i) The size $n$ of the input data and the characteristics of the particular input data.
(ii) The number of basic key operations that must be performed when the algorithm is executed, while noting they generally include addition, subtraction, multiplication, division, and comparison.

Example 12.3
Discuss the algorithms required to perform the following mathematical operations:
(a) Matrix multiplication using direct method.
(b) Polynomial evaluation using Horner’s method.
Solution
(a) In the multiplication of two matrices, order matters (i.e., matrix multiplication is not commutative). In order to multiply two matrices, we must first make sure that the number of columns in the first matrix equals the number of rows in the second matrix, as this is the prerequisite for multiplication. The widely known direct method is as follows: if the first matrix is an $m \times n$ matrix and the second matrix is an $n \times p$ matrix, where $m, n$, and $p$ are all positive integers, then their matrix product is the $m \times p$ matrix, whose entries are given by the dot product of the corresponding row of the first matrix and the corresponding column of the second matrix. In other words, we multiply the elements of row $i$ of the first matrix by the elements of column $j$ in the second matrix to obtain the element of the $i$ th row and $j$ th column of the product. The algorithm to perform this matrix multiplication thus requires $m p n$ multiplications and $m p(n-1)$ additions. Note that there are other algorithms that require a smaller number of multiplications and additions to multiply two matrices than the direct method does.
(b) Consider the following function $f(x)$, which is a polynomial of degree $n$ :
$$f(x)=a_n x^n+a_{n-1} x^{n-1}+\ldots+a_2 x^2+a_1 x+a_0 .$$
Suppose we want to evaluate $f(x)$ for $x=c$, that is, $f(c)$. We can consider two different algorithms for a polynomial evaluation. The first is known as the direct method, which requires $n+(n-1)+(n-2)+\ldots+1=\frac{n(n+1)}{2}$ multiplications and $n$ additions. The second is known as Horner’s method, which is based on rewriting the polynomial by successively factoring out $x$, and is as follows:
\begin{aligned} f(x) & =a_0+a_1 x+a_2 x^2+\ldots+a_{n-1} x^{n-1}+a_n x^n \ & =a_0+x\left(a_1+x\left(a_2+\ldots+x\left(a_{n-1}+x a_n\right)\right)\right) . \end{aligned}
Horner’s method is significantly more efficient than the direct method, as it requires only $n$ multiplications and $n$ additions.

## 数学代写|离散数学代写Discrete Mathematics代考|Complexity of Algorithms

(i) 大小 $n$ 输入数据的特征和特定输入数据的特征。
(ii) 执行算法时必须执行的基本关键橾作的数量，同时注意它们通常包括加法、减法、乘法、除法和比较。

(a) 使用直接法的矩阵乘法。
(b) 使用 Horner 方法的多项式评估。

(a) 在两个矩阵的乘法中，顺序很重要（即矩阵乘法不可交换)。为了将两个矩阵相乘，我们必须首先确保第 一个矩阵的列数等于第二个矩阵的行数，因为这是乘法的前提。广为人知的直接方法如下: 如果第一个矩阵是 $m \times n$ 矩阵和第二个矩阵是 $n \times p$ 矩阵，其中 $m, n$ ，和 $p$ 都是正整数，那么它们的矩阵乘积就是 $m \times p$ 矩阵， 其条目由第一个矩阵的相应行和第二个矩阵的相应列的点积给出。换句话说，我们将行的元责相乘例的元溸的 第一个矩阵 $j$ 在第二个矩阵中获取元維 $i$ 行和 $j$ 产品的第列。因此，执行此矩阵乘法的算法需要 $m p n$ 乘法和 $m p(n-1)$ 添加。请注意，与直接方法相比，还有其他算法需要较少数量的乘法和加法来将两个矩阵相乘。 (b) 考虑以下函数 $f(x)$, 这是一次多项式 $n$ :
$$f(x)=a_n x^n+a_{n-1} x^{n-1}+\ldots+a_2 x^2+a_1 x+a_0 .$$

$$f(x)=a_0+a_1 x+a_2 x^2+\ldots+a_{n-1} x^{n-1}+a_n x^n \quad=a_0+x\left(a_1+x\left(a_2+\ldots+x\left(a_{n-1}+x a_n\right)\right)\right) .$$
Horner 的方法明显比直接方法更有效，因为它只需要 $n$ 乘法和 $n$ 添加。

## MATLAB代写

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