数据结构之树和二叉树---二叉树的基本操作

数据结构--二叉树 树是一种非线性的数据结构,它是由nn>=0)个有限结点组成一个具有层次关系的集合。把它叫做树是因为它看起来像一棵倒挂的树,也就是说它是根朝上,而叶朝下的。它具有以下的特点:1.有一个特殊的结点,称为根结点,根结点没有前驱结点2.除根结点外,其余结点被分成M(M > 0)个互不相交的集合3.树是递归定义的。注意:树形结构中,子树之间不能有交集,否则就不是树形结构。 阅读详情

问题:二叉树的基本操作函数,主要内容为二叉树的数据结构,初始化二叉树,销毁二叉树,创建二叉树,求二叉树深度,二叉树双亲节点,二叉树左孩子,二叉树右孩子,二叉树左兄弟,二叉树右兄弟,根据名称查找二叉树节点,插入节点及删除节点


//二叉树数据结构

typedef struct BiTNode
{
	TElemType data;
	struct BiTNode* lchild, * rchild;
}BiTNode, *BiTree;

//初始化二叉树

FILE* BTEF;
BiTree InitBiTree()
{
	BiTree bt;
	bt = NULL;
	BTEF = fopen("BiTreeElem.txt", "r");
	return bt;
}

//销毁二叉树

void DestroyBiTree(BiTree bt)
{
	if(bt)
	{
		DestroyBiTree(bt->lchild);
		DestroyBiTree(bt->rchild);
		free(bt);
	}
        fclose(BTEF);
}



//创建二叉树

//通过文本文件读取二叉树节点信息,空节点以“0”表示,节点顺序为二叉树先序遍历顺序

void CreatBiTree(BiTree *bt)
{
	char node;

	fread(&node, sizeof(char), 1, BTEF);
	if(node==' ')
		fread(&node, sizeof(char), 1, BTEF);

	if(node=='0')
		*bt = NULL;
	else
	{
		if(*bt==NULL)
			*bt = (BiTree) malloc (sizeof(BiTNode));
		(*bt)->data = node;
		(*bt)->lchild = NULL;
		(*bt)->rchild = NULL;
		CreatBiTree(&(*bt)->lchild);
		CreatBiTree(&(*bt)->rchild);
	}
}
//文本信息样例

/*A B D 0 F 0 0 0 C 0 E G 0 0 0*/

//求二叉树深度

int BiTreeDepth(BiTree bt)
{
	int leftBTDepth, rightBTDepth;

	if(bt==NULL)
		return 0;
	else
	{
		leftBTDepth = BiTreeDepth(bt->lchild)+1;
		rightBTDepth = BiTreeDepth(bt->rchild)+1;
		return leftBTDepth>rightBTDepth? leftBTDepth:rightBTDepth;
	}
}

//二叉树双亲节点

//查找信息的依据是节点名称,返回值为节点指针

BiTNode* BiTreeParent(BiTree bt, TElemType elem)
{
	BiTNode* btn;
	if(bt!=NULL)
	{
		if (bt->lchild!=NULL)
		{
			if(bt->lchild->data!=elem)
			{
				btn = BiTreeParent(bt->lchild,elem);
				if(btn!=NULL)
					return btn;
			}
			else
				return bt;
		}
		if (bt->rchild!=NULL)
		{
			if(bt->rchild->data!=elem)
				return BiTreeParent(bt->rchild,elem);
			else
				return bt;
		}
	}
	return NULL;
}

//二叉树左孩子


BiTNode* LeftChild(BiTree bt, TElemType elem)
{
	BiTNode* tbn;
	if(bt!=NULL)
	{
		if(bt->data==elem)
			return bt->lchild;
		else
		{
			tbn = LeftChild(bt->lchild, elem);
			if(tbn!=NULL)
				return tbn;
			return LeftChild(bt->rchild, elem);
		}
	}
	return NULL;
}

//二叉树右孩子

BiTNode* RightChild(BiTree bt, TElemType elem)
{
	BiTNode* tbn;
	if(bt!=NULL)
	{
		if(bt->data==elem)
			return bt->rchild;
		else
		{
			tbn = RightChild(bt->lchild, elem);
			if(tbn!=NULL)
				return tbn;
			return RightChild(bt->rchild, elem);
		}
	}
	return NULL;
}

//二叉树左兄弟

BiTNode* LeftSibling(BiTree bt, TElemType elem)
{
	BiTNode *tbn;
	if(bt==NULL)
		return NULL;
	if (bt->rchild!=NULL)
	{
		if(bt->rchild->data==elem)
			return bt->lchild;
		else
		{
			tbn = LeftSibling(bt->rchild, elem);
			if(tbn!=NULL)
				return tbn;
		}
	}
	 return LeftSibling(bt->lchild, elem);
}

//二叉树右兄弟

BiTNode* RightSibling(BiTree bt, TElemType elem)
{
	BiTNode *tbn;
	if(bt==NULL)
		return NULL;
	if (bt->lchild!=NULL)
	{
		if(bt->lchild->data==elem)
			return bt->lchild;
		else
		{
			tbn = RightSibling(bt->lchild, elem);
			if(tbn!=NULL)
				return tbn;
		}
	}
	return RightSibling(bt->rchild, elem);
}

//根据名称查找二叉树节点

BiTNode* SearchNode(BiTree bt, TElemType elem)
{
	BiTNode *tbn;
	if(bt==NULL)
		return NULL;
	if(bt->data==elem)
		return bt;
	else
	{
		tbn = SearchNode(bt->lchild, elem);
		if(tbn!=NULL)
			return tbn;
		return SearchNode(bt->rchild, elem);
	}
	return NULL;
}

//插入节点

//插入节点时,需要插入节点或子树指针,插入节点双亲名称,及作为双亲节点的左孩子还是右孩子
int InsertChild(BiTree bt, TElemType elem, int LR, BiTree child)
{
	BiTNode* pn;
	if (!child||!bt||(LR!=0&&LR!=1))
		return -1;
	if (LR==0)
	{
		pn = LeftChild(bt, elem);
		if(pn==NULL)
			SearchNode(bt, elem)->lchild = child;
		else
			return -1;
	} 
	else
	{
		pn = RightChild(bt, elem);
		if(pn==NULL)
			SearchNode(bt, elem)->rchild = child;
		else
			return -1;
	}
	return 0;
}

//删除节点

int DeleteChild(BiTree bt, TElemType elem, int LR)
{
	BiTNode* pn;
	if(!bt||(LR!=0&&LR!=1))
		return -1;
	if(LR==0)
	{
		pn = LeftChild(bt, elem);
		if(pn!=NULL)
		{
			DeleteChild(bt, pn->data, 0);
			DeleteChild(bt, pn->data, 1);
			free(pn);
			if((pn=SearchNode(bt,elem))!=NULL)
				pn->lchild = NULL;
		}
	}else
	{
		pn = RightChild(bt, elem);
		if(pn!=NULL)
		{
			DeleteChild(bt, pn->data, 0);
			DeleteChild(bt, pn->data, 1);
			free(pn);
			if((pn=SearchNode(bt,elem))!=NULL)
				pn->rchild = NULL;
		}
	}
}




【数据结构】非线性结构——二叉树 前面我们都是学的线性结构的数据结构,接下来我们就需要来学习非线性的数据结构,我们先来学第一个非线性的数据结构——树。每一门学科都来自生活,从生活中学习,我们要学的树就是来自生活,这种数据结构就像我们大自然中的树倒立着一样,所以我们取名为树。 阅读详情

相关推荐

数据结构实验-二叉树的基本操作

一、问题描述 运用二叉链表实现二叉树的基本操作,包括:创建二叉树的存储结构、复制已有的二叉树、计算已有的二叉树的深度、先根序序列、中根序序列、后根序序列等。 输入格式:AB#C##D## 二、实验目的 掌握二叉链表及二叉树的基本操作。 三、实验内容及要求 1、构造二叉树的二叉链表数据结构。 2、实现二叉树的创建、复制、计算二叉树的深度、先根序序列、中根序序列、后根序序列等操作。

二叉树的读入

二叉树的读入 下面是创建及遍历的代码: #include <iostream> #include <stack> using namespace std; typedef struct BitNode { //创建二叉树的结构体; char data; BitNode* lchild, * rchild; BitNode(char ch) //添加创建新结点的构造函数; { data = ch; lchild = NULL; rchild = N

m0_51851827的博客 1458

数据结构试验报告(树和二叉树的基本操作)

数据结构试验报告(树和二叉树的基本操作),包含详细的函数分析、程序源代码及测试数据和结果!

二叉树的基本操作(递归和非递归遍历,分支节点数)

二叉树的定义: 二叉树是由n(n&gt;=0)个结点的有限集合构成,此集合或者为空集,或者由一个根结点及两棵互不相交的左右子树组成,并且左右子树都是二叉树. 递归定义:叉树可以是空集合,根可以有空的左子树或空的右子树。二叉树不是树的特殊情况,它们是两个概念。 typedef char ElemType; typedef struct BiTNode{ ElemType data; ...

小熊的学习记录 2075

MCGS触摸屏Modbus TCP通讯实战:从寄存器写入到字符串处理的完整代码解析

本文详细解析了MCGS触摸屏通过Modbus TCP协议实现寄存器写入和字符串处理的完整代码,涵盖单寄存器写入、多寄存器写入及字符串传输等核心技术。文章还提供了MCGS组态环境中的实战配置步骤和常见问题排查方法,帮助开发者快速掌握工业自动化通讯的关键技术。

study的专栏 755

鱼眼双目测距实战:从OpenCV标定到SGBM匹配的完整流程解析

本文详细解析了鱼眼双目测距的完整流程,从OpenCV标定到SGBM匹配,涵盖标定、校正、匹配和测距四个关键阶段。通过实战经验分享,帮助开发者解决鱼眼镜头强畸变带来的测距挑战,提升测距精度至5%以内。特别适合机器人导航、自动驾驶和VR领域的开发者参考。

weixin_27298377的博客 124

【数据结构实验五】树和二叉树的基本操作

一、二叉树的基本操作(非递归) 输入格式: 第1行输入在二叉树中查找的元素。 第2行按先序顺序输入节点值构造二叉树,输入#代表节点为空,用#补全所有度不为 2 的节点,使其度为 2。例如:ABD#E###CF##GH##I##。 测试数据保证能构成二叉树。 输出格式: 参照主函数及输出样例。输出格式使用%c,输出字符串中使用中文标点符号。 输入样例1: E ABD#E###CF##GH##I## 输出样例1: 先序遍历二叉树:ABDECFGHI 中序遍历二叉树:DEBAFCHGI

weixin_61639349的博客 2725

Cocos Creator实战:5步搞定棋牌游戏大厅场景开发(附完整代码)

本文详细介绍了使用Cocos Creator 3.8开发棋牌游戏大厅的5个关键步骤,包括工程配置、动态UI系统实现、核心交互功能开发、性能优化及调试发布技巧。通过模块化代码和实战案例,帮助开发者快速构建高交互性的棋牌游戏大厅,提升用户留存率。

weixin_29002209的博客 354

[Data Structure] 数据结构中各种树

  数据结构中有很多树的结构,其中包括二叉树、二叉搜索树、2-3树、红黑树等等。本文中对数据结构中常见的几种树的概念和用途进行了汇总,不求严格精准,但求简单易懂。 1. 二叉树   二叉树是数据结构中一种重要的数据结构,也是树表家族最为基础的结构。   二叉树的定义:二叉树的每个结点至多只有二棵子树(不存在度大于2的结点),二叉树的子树有左右之分,次序不能颠倒。二叉树的第i层至多有2i-1个...

weixin_33749131的博客 820

嵌入式开发必备:UART、RS232、RS485通信协议实战对比(附代码示例)

本文从嵌入式开发实战角度,深度对比了UART、RS232和RS485三种核心串行通信协议。详细解析了它们的工作原理、硬件连接、代码配置及典型应用场景,并提供了基于通信距离、节点数量和电磁环境的三维度选型指南,帮助开发者根据项目需求做出最优技术决策。

i0j1k2l3m的博客 474

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory解决方案

本文主要介绍了ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory解决方案,希望能对使用Python的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 11万+

树和二叉树的基本概念操作

第四章 树和二叉树 一、二叉树 1、二叉树的基本概念(逻辑结构) 二叉树的定义 二叉树是n(n>=0)个结点的有限集合。n=0时,二叉树为空树;n>0时,由根结点和两个互不相交的被称为根的左子树和右子数组成。左子树和右子树也分别是一棵二叉树 五种基本形态 二叉树的分类 1、满二叉树:一棵高度为h,且含有2^h-1个结点的二叉树(编号顺序从上至下,从左至右) 对于编号为i的...

wsndbbhh的博客 723

部署与可视化系统:零基础到精通:LabVIEW 调用 YOLO 动态链接库(DLL)的保姆级视觉检测系统融合实战

LabVIEW与YOLO26深度集成:工业视觉检测新范式 本文揭示了LabVIEW与最新YOLO26模型深度集成的创新方案,通过C++封装ONNX Runtime为DLL,在LabVIEW中实现端到端视觉检测。核心突破点包括: 技术选型:对比YOLOv5/YOLOv8/YOLO26性能,YOLO26在CPU推理速度提升43%,支持NMS-Free端到端推理 部署架构:提供ONNX Runtime C++ API和TensorRT两种DLL封装路径,适配不同硬件环境 工程实现:详细展示从PyTorch模型导出

ZXSXJ的博客 282

【数据结构】树,二叉树,满二叉树,完全二叉树的定义和二叉树的基本操作

讲解树,二叉树,满二叉树,完全二叉树的定义和二叉树的基本操作

小吉妙妙屋 3024

枪支/刀具检测 (gun, knife) - SIXray, Clasp Dataset,YOLOv11+UI界面+数据集

python复制编辑# 计算 CIoU 损失。

YOLO 539

23、OpenMP常见用例与标准循环级示例详解

本文详细介绍了OpenMP的三种典型用例:循环级OpenMP、高级OpenMP和MPI+OpenMP,适用于不同层次的并行需求。重点讲解了循环级OpenMP在向量加法、流三元组和模板计算中的应用示例,并探讨了首次触摸优化、线程绑定、NUMA架构影响等关键性能优化策略。通过实际代码演示和性能分析,帮助开发者快速掌握OpenMP的基础并行化方法,并为后续高性能优化提供指导。

fanta的博客 87

数据结构与算法实验—— 树、二叉树和森林的基本操作

了解树和森林的概念,包括树的定义、树的术语。掌握线索化二叉树的特性及寻找某结点的前驱和后继的方法。了解树的存储、树和森林与二叉树的转换方法。(2)以(1)中结点作为根结点,使用递归算法创建一棵图 5-1(主教材 P267 图 5-48)所示的树。创建名为 ex050601_01.py 的文件,在文件中定义两个类,一个是树的结点类,该。类包含结点的相关信息(如结点的值和所有的子树);(7)插入值为 G 的结点,使其是值为 D 的结点的第一个孩子结点。理解树的存储结构,并掌握树的基本操作。

ZQW1314520的博客 880

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

数据结构与算法 实验5 树、二叉树和森林的基本操作

1. 实验目的 理解树的存储结构,并掌握树的基本操作。 2. 实验介绍 了解树和森林的概念,包括树的定义、树的术语。掌握二叉树的概念、性质及二叉树的表示。熟练掌握二叉树的遍历算法,并且能灵活运用遍历算法实现二叉树的其他操作。掌握线索化二叉树的特性及寻找某结点的前驱和后继的方法。了解树的存储、树和森林与二叉树的转换方法。掌握哈夫曼树的实现方法、构造哈夫曼编码的方法及带权路径长度的计算。 3.实验内容 创建名为 ex050601_01.py 的文件,在文件中定义两个类,一个是树的结点类,该 类包..

绯雨千叶的博客 1686

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

Java~数据结构(四)~二叉树(什么是树&树一些概念&二叉树&二叉树的基本操作和前中后遍历)

树的基础知识 二叉树 两种特殊的二叉树 如何储存一棵二叉树 二叉树的基本操作 二叉树的遍历 树的基础知识 什么是树? 树是一种数据结构。由n个节点(n>=0)个有限节点组成一个具有层次关系的集合。 树是递归定义的。

zxc的博客 606

数据结构与算法之树和二叉树(一):二叉树基本操作的实现及应用

一.二叉树的基本操作实现 1.二叉树存储结构 二叉树可以用顺序表(完全二叉树比较适合)存储,也可以用链式结构(二叉链表)存储,其数据结构表示如下: 抽象出来就是这样: 2.二叉树遍历 二叉树遍历根据结点间遍历顺序可分为先序、中序、后序三种方式, 遍历有递归和非递归两种写法;如图为先序遍历的二叉树及其抽象树状图: 3.完全二叉树定义及其实现 以下为完全二叉树和其他二叉树的直观对比: 4.代码实现(所有代码均在Embarcadero DevC++6.0和VSCode 2021上编译运行通过): #d

m0_46339652的博客 1281

数据结构——c语言描述 第六章(1)二叉树树的基本操作和二叉树的线索化

数据结构笔记

算法虐我千百遍 765

数据结构(C语言版)第五章树和二叉树

数据结构(C语言版)第五章树和二叉树

2301_76828807的博客 1667

数据结构--树(1)

数据结构--树(1)

YA10JUN的博客 1380

树(Tree)和二叉树

​二叉树性质 (1)在二叉树的第i层上至多有2^(i-1)个结点(i>=1) (2)深度为k的二叉树至多有2^k-1个结点(k>=1) 可以看上面的图,深度为4,一共有2^4 -1= 15个结点 (3)对于任何一颗二叉树T,如果其终端结点数为n0,度为2的结点数为n2,则n0=n2+1 (4)具有n个节点的完全二叉树深为log2x+1(其中x表示不大于n的最大整数) (5)如果对一颗有n个结点的完全二叉树(其深度为[log2n]+1)的结点按层序编号(从 层到[log2......

m0_58761900的博客 4399

数据结构-二叉树

二叉树是一种特殊的树,其中每个节点最多有2个子节点,这两个子节点通常称为左子节点和右子节点,二叉树是节点的一个有限的集合。

2301_76928097的博客 1703

java 数据结构 二叉树

树是一种非线性的数据结构,它是由n(n>=0)个有限结点组成一个具有层次关系的集合。把它叫做树是因为它看 起来像一棵倒挂的树,也就是说它是根朝上,而叶朝下的。它具有以下的特点:有一个特殊的结点,称为根结点,根结点没有前驱结点

N_0050的博客 1036
上一篇: 数据结构之栈和队列---回文判断
下一篇: 数据结构之树和二叉树---二叉树的遍历
O淘_气O
博客等级 码龄14年 22粉丝 8原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值