第六次作业和答案
This commit is contained in:
parent
9b8a1318db
commit
f9992eecc9
3 changed files with 341 additions and 19 deletions
49
source/_posts/homework6.md
Normal file
49
source/_posts/homework6.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
title: 第六次作业(题目)
|
||||
date: 2020-11-20 12:26:17
|
||||
tags:
|
||||
mathjax: true
|
||||
---
|
||||
|
||||
# 冒泡排序
|
||||
|
||||
对 10 个伪随机数冒泡排序,伪随机数产生方法可参考上面习题指导第 127 页,注意冒泡排序排好了要能提前退出。
|
||||
|
||||
# 矩阵乘法
|
||||
|
||||
实现两个矩阵相乘。
|
||||
|
||||
# P166 T13
|
||||
|
||||
编一程序,将两个字符串连接起来,不要用`strcat`函数。
|
||||
|
||||
# P216 T13
|
||||
|
||||
用递归方法求 $n$ 阶勒让德多项式的值,递归公式为:
|
||||
|
||||
$$
|
||||
\begin{equation*}
|
||||
P_{n}(x) = \left \{
|
||||
\begin{array}{ll}
|
||||
1 & (n = 0) \\
|
||||
x & (n = 1) \\
|
||||
((2n-1) \times x P_{n-1}(x) - (n-1) \times P_{n-2}(x) ) / n & (n \geq 1)
|
||||
\end{array}
|
||||
\right .
|
||||
\end{equation*}
|
||||
$$
|
||||
|
||||
# P216 T14
|
||||
|
||||
输入 5 个学生 3 门课的成绩,分别用函数实现下列功能:
|
||||
|
||||
1. 计算每个学生的平均分;
|
||||
2. 每门课的平均分;
|
||||
3. 找出所有 15 个中最高的所对应的学生和课程;
|
||||
4. 计算平均分方差。
|
||||
|
||||
$$
|
||||
\begin{equation*}
|
||||
\sigma = \frac{1}{n} \sum x_i^2 - \left ( \frac{\sum x_i}{n} \right ) ^2
|
||||
\end{equation*}
|
||||
$$
|
Loading…
Add table
Add a link
Reference in a new issue