ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

作业Day4

2021-08-02 14:01:37  阅读:215  来源: 互联网

标签:mathbf parent int vi Day4 作业 节点 vj


Q1:定义无向网络

Definition: An undirected net is a tuple G = ( V , w ) G=(\mathbf V,w) G=(V,w),where V \mathbf V Vis the set of nodes,and w : V × V → R w:\mathbf V\times \mathbf V\to\R w:V×V→R is the weight function where w ( v i , v j ) w(v_i,v_j) w(vi​,vj​) is the weight of the arc ⟨ v i , v j ⟩ \langle v_i,v_j\rangle ⟨vi​,vj​⟩ and w ( v i , v j ) = w ( v j , v i ) w(v_i,v_j)=w(v_j,v_i) w(vi​,vj​)=w(vj​,vi​), v i , v j ∈ V v_i,v_j\in\mathbf V vi​,vj​∈V

Q2.1:自己画一棵树, 将其元组各部分写出来

在这里插入图片描述
A tree is a triple T = ( V , r , p ) T = (\mathbf{V}, r, p) T=(V,r,p)
In this tree, V = { a , b , c , d , e , f , g } , r = a \mathbf V=\{a,b,c,d,e,f,g\},r=a V={a,b,c,d,e,f,g},r=a,
p ( f ) = p ( g ) = d , p ( e ) = c , p ( d ) = b , p ( b ) = p ( c ) = a , p ( a ) = ϕ p(f)=p(g)=d,p(e)=c,p(d)=b,p(b)=p(c)=a,p(a)=\phi p(f)=p(g)=d,p(e)=c,p(d)=b,p(b)=p(c)=a,p(a)=ϕ

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

public class Tree {
	//节点数. 表示节点 v_0 至 v_{n-1}.
	int n;
	//根节点. 0 至 n-1.
	int root;
	//父节点.
	char[] parent;

	/**
	 * 构造一棵树, 第一个节点为根节点, 其余节点均为其直接子节点, 也均为叶节点.
	 */
	public Tree(int paraN) {
		n = paraN;
		parent = new char[n];
		parent[0] = -1; // -1 即 \phi
	}// Of the constructor
}//Of class Tree
a:								b:
n = 7							n=4
root = 'a'						root = 'b'
parent = null					parent = 

???

标签:mathbf,parent,int,vi,Day4,作业,节点,vj
来源: https://blog.csdn.net/weixin_44569973/article/details/119322341

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有