### CS代写|程序设计作业代写algorithm Programming代考|Construct a flowchart to show

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

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• Advanced Probability Theory 高等概率论
• Advanced Mathematical Statistics 高等数理统计学
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## CS代写|程序设计作业代写algorithm Programming代考|Construct a flowchart to show

Problem 3.23. Construct a flowchart to show how you can decide if a given number is prime or not.

Task Analysis. We know that a number can be called a prime number if, and only if, it has no divisor or factor except itself and unity, i.e., 1. In order to declare that a number is a prime number, we need to prove that the number is not divisible by any number starting from 2 to the half of the given number because we have already seen that if a number has some divisor at all, it must lie within the half of the number. A better, more efficient strategy is to limit the checking within the integer part of the square root of the number. For example, to check if the number 97 is a prime number, we need check whether there exists some divisor of 97 within 2 to 48 (both inclusive). This checking can be done from 2 to 9 , because 9 is the integer part of the square root of 97 . The number of checking is decreased to a large extent. The divisors can be generated automatically by changing the value of a variable location. Assuming that the procedure for determining the square root of a number is available, we can draw the flowchart for the task.

The following algorithm shows the steps leading to the solution for Problem 3.23:
Step 1. INPUT TO N
[ACCEPT THE NUMBER WHOSE SQUARE ROOT IS TO BE FOUND]
Step 2. COMPUTE SR $\leftarrow$ SQUARE ROOT OF (N)
Step 3. [INITIALIZE] I $\leftarrow 2, \mathrm{FLAG} \leftarrow 0$
[FLAG contains the divisibility status of the number]
Step 4. WHILE I $<=S R$ DO
(i) COMPUTE $\mathrm{R} \leftarrow$ REMAINDER OF (N/I)
(ii) IF $\mathrm{R}=0$
THEN FLAG $\leftarrow 1$
EXIT
END-IF
(iii) COMPUTE I $\leftarrow$ I $+1$
(Increment I to obtain the next divisor]
Step 5. IF FLAG =0
THEN PRINT “It is a prime number.”
ELSE
PRINT”It is not a prime number.”
END-IF
Step 6. STOP

## CS代写|程序设计作业代写algorithm Programming代考|The algorithm below shows the solution of Problem

The algorithm below shows the solution of Problem $3.24$.
Step 1. INPUT TO N
[Establish N, the number of FIBONACCI NUMBERS to be generated]
Step 2. [INITIALIZE VARIABLES WITH THE FIRST TWO FIBONACCI NUMBERS]
$\mathrm{T} 1 \leftarrow 0, \quad \mathrm{~T} 2 \leftarrow 1$
Step 3. [INITIALIZE THE COUNTER VARIABLE]
COUNT $\leftarrow 0$
Step 4. WHILE COUNT $<=\mathrm{N}$
(i) COMPUTE $\mathrm{T} \leftarrow \mathrm{T} 1+\mathrm{T} 2$
(ii) PRINT Tl
(iii) COMPUTE COUNT $\leftarrow$ COUNT $+1$
(iv) $\mathrm{T} 1 \leftarrow \mathrm{T} 2$
(v) $\mathrm{T} 2 \leftarrow \mathrm{T}$
Step 5. STOP
Problem 3.25. Construct a flowchart to show if a given year is leap year.
Task Analysis. A given year is said to be a leap year if it is a non-century year (i.e., not like 1900,1800 , or 1600 ) and it is divisible by 4 . In case it is a century year, then it must be divisible by 400 to be a leap year. To determine whether a given year is a leap year, we determine whether the year is divisible by 4 but not by 100 or if it is divisible by 400 . The divisibility is tested again in the way as we have seen earlier, i.e., by checking whether the remainder in the division process is zero or not.
Step 1. $\quad \mathrm{Y} \leftarrow 1$
Step 2. REPEAT STEPS 2 TO 8 UNTIL $\mathrm{Y}=0$
Step 3. INPUT TO Y
[ACCEPT YEAR TO BE TESTED AND STORE IT IN Y]
Step 4. IF $Y=0$
THEN EXIT
END-IF
Step 5. COMPUTE R $1 \leftarrow$ REMAINDER OF (Y/400)
Step 6. $\quad$ IF Rl $=0$
THEN PRINT “THE GIVEN YEAR IS A LEAP YEAR” END-IF

## CS代写|程序设计作业代写algorithm Programming代考|The square root of a number

Task Analysis. The square root of a number can be obtained by using the Newton Raphson Method. In this method, the square root of any positive number is initially set to 1 . Then the absolute value of the difference between

the square of the assumed square root and the given number is obtained. This value is then compared with some predefined small positive number. This small positive number is set in such a way that an error of magnitude less than that is made acceptable. If the difference is less than the small positive number, the assumed square root is used as the desired square root. For perfect squares, this difference becomes zero; for others, this difference is usually found to be of magnitude less than $.01, .001$, or .0001, depending upon the precision required. If the difference is greater than or equal to the small positive number like $.001$ or $.0001$, then the assumed value is increased to have a better guess by using the formula
$$\left(\text { Guessed Value }+\frac{\text { Number }}{\text { Guessed Value }}\right) / 2$$
The procedure is repeated until we get a guessed value satisfying the condition specified. Algorithmically, we can express the procedure as shown below.
Let X be the number whose square root is to be obtained.

1. Set Guess to $1 .$
2. If $\mid$ GUESS*GUESS-X $\mid<$ Epsilon
Then go to step 5
(Epsilon is a predefined small positive number)
3. Set Guess to $\left(\right.$ Guess $\left.+\frac{\mathrm{X}}{\text { Guess }}\right) / 2$
4. Go to Step 2
5. Guess is the square root of X.
The flowchart corresponding to Problem $3.26$ is shown in next page. The algorithm for the solution of Problem $3.26$ is given below:
Step 1. INPUT TO X
Step 2. [INITIALIZE] GUESS $\leftarrow 1$, EPSILON $\leftarrow .001$
Step 3. WHILE absolute value of $(\mathrm{GUESS} * \mathrm{GUESS}-\mathrm{X})<=$ EPSILON DO
$\mathrm{COMPUTE} \mathrm{GUESS} \leftarrow\left(\mathrm{GUESS}+\frac{\mathrm{X}}{\mathrm{GUESS}}\right) / 2$
Step 4. PRINT “THE SQUARE ROOT IS”, GUESS
Step 5. STOP

## CS代写|程序设计作业代写algorithm Programming代考|Construct a flowchart to show

[接受要求平方根的数]

[FLAG 包含数字的整除状态]
Step 4. WHILE I<=小号R做
(i) 计算R←(N/I)
(ii) IF的剩余部分R=0

END-IF
(iii) 计算 I←一世+1
（增加 I 以获得下一个除数）
Step 5. IF FLAG =0
THEN PRINT “It is a prime number.”
ELSE
PRINT“It is not a prime number.”
END-IF
Step 6. STOP

## CS代写|程序设计作业代写algorithm Programming代考|The algorithm below shows the solution of Problem

[建立 N，要生成的斐波那契数]

(一) 计算吨←吨1+吨2
(ii) 打印 Tl
(iii) 计算计数←数数+1
(四)吨1←吨2
（在）吨2←吨

[接受要测试的年份并将其存储在 Y]

END-IF

## CS代写|程序设计作业代写algorithm Programming代考|The square root of a number

( 猜测值 + 数字  猜测值 )/2

1. 将猜测设置为1.
2. 如果∣GUESS*GUESS-X∣<Epsilon
然后转到第 5 步
（Epsilon 是一个预定义的小正数）
3. 将猜测设置为(猜测+X 猜测 )/2
4. 转到第 2 步
5. Guess 是 X 的平方根
。Problem 对应的流程图3.26显示在下一页。解决问题的算法3.26如下所示：
步骤 1. 输入到 X
步骤 2. [初始化] GUESS←1, 爱普生←.001
步骤 3. WHILE 的绝对值(G在和小号小号∗G在和小号小号−X)<=爱普生做
C这米磷在吨和G在和小号小号←(G在和小号小号+XG在和小号小号)/2
第 4 步。打印“平方根是”，猜猜
第 5 步。停止

## 有限元方法代写

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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。