smale学习之数学表达式(day4)

闵老板帖子:数学表达式魔训


Q1.写出该无向图的邻接矩阵.

在这里插入图片描述

邻接矩阵表示为:

$$\mathbf{E} = \begin{bmatrix} 0& 1& 1& 1 \\ 1 &0 &1 &0 \\ 1 &1 & 0& 1 \\1 &0 &1 & 0 \end{bmatrix}$$

Q2.定义无向网络.

 Definition: An  undirected net is a tuple \(G =(\mathbf{V}, w)\), where \(\mathbf{V}\) is the set of nodes, and \(w:\mathbf{V} \times \mathbf{V} \to \mathbb{R}\) is the weight function where \(w(v_i, v_j)\) is the weight of the edge \((v_i, v_j)\), and \(w(v_i, v_j) = w(v_j, v_i)\).

Q3.自己画一棵树, 将其元组各部分写出来 (特别是函数\(p\)).

 在这里插入图片描述

 \(\mathbf{V} = \{v_0, v_1, v_2, v_3, v_4, v_5 \}\).

\( r = v_0 \).

\( p^0(v_0) = v_0, p(v_1) = v_0, p(v_2) = v_0, p(v_3) = v_0, p(v_4) = v_1, p^2(v_4) = v_0, p(v_5) = v_1, p^2(v_5) = v_0\).

Q4.针对该树, 将代码中的变量值写出来 (特别是 parent 数组).

n = 6;
root = 0;
parent = new int[6];
parent[0] = -1;
parent[4] = 1;
parent[5] = 1;

Q5.画一颗三叉树, 并写出它的child数组.

 在这里插入图片描述

(二次使用.)

child数组表示为:\(\{ \{1, 2, 3\},\{ 4, 5, -1\}, \{-1, -1, -1\}, \{-1, -1, -1\} ,\{-1, -1, -1\}, \{-1, -1, -1\} \} \).

矩阵:

$$C = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & -1 \\ -1& -1 &-1 \\ -1& -1 &-1 \\  -1& -1 &-1 \\ -1& -1 &-1 \end{bmatrix}$$

Q6.按照本贴风格, 重新定义树. 提示: 还是应该定义 parent 函数, 字母表里面只有一个元素.

Definition: let \(\phi\) be the empty node, an \(m\)-tree is a quadruple \(T = \{\mathbf{V}, r, \Sigma, p\}\) where

a)\(\mathbf{V}\) is the set of nodes;

b)\( r \in \mathbf{V}\) is the root node;

c)\(\Sigma\) is the alphabet, and \(\Sigma = \{1\}\);

d)\(p :  (\mathbf{V} \cup \{\phi\}) \times \Sigma^* \to \mathbf{V} \times \{\phi\}\) is the parent funciton satisfying

  \(\forall v \in \mathbf{V}, \exists ! s \in \Sigma^*\)  st.\(p(v, s) = r.\)

Q7.根据图、树、\(m\)-叉树的学习, 谈谈你对元组的理解.

元组不同于其他的“容器”, 它能将不同类型的对象存储到一起,  使得我们在图、树、\(m\)-叉树的定义中更加的简便. 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值