数据结构——二叉搜索树(Binary Search Tree)
二叉树(Binary Tree)的基础下
每个父节点下 左节点小,右节点大。
节点的插入:
若root==NULL则root=newnode
否则不断与节点值比较,较小则向左比较,较大则向右比较。
完整代码:
stnode *insert(const string &item)
{
stnode *t=root,*newnode,*parent=NULL;
while(t!=NULL)
{
parent=t;
if(item==t->nodeValue)
return NULL;
else if(item<t->nodeValue)
t=t->left;
else
t=t->right;
}
newnode=creatAVLNode(item,NULL,NULL,parent);
if(parent==NULL)
root=newnode;
else if(item>parent->nodeValue)
parent->right=newnode;
else
parent->left=newnode;
treeSize++;
}//返回节点值是为之后的其他操作 也可以是void
此处的insert返回类型可以为pair对
pair<stree<T>::iterator,bool>insert(const T&item);
insert.first 即为迭代器的值
// iterator=tree.begin()++ 树的最左节点(min),从小到大遍历,往右边的最左走。
insert.second 即为bool值
节点的删除:
*每一种情况下都要讨论是否为root。
1、叶子节点
t->parent->left/right=NULL;
delete t;
2、只有左/右子树
直接拿子节点填补空缺,成为t->parent的子节点。
3、同时有左右子树
选择左子树的最右节点或者右子树的最左节点填补空缺。
注意讨论替换节点是否有子树以及父节点的不同情况。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASQAAAEcCAIAAADhsl57AAAdoUlEQVR4nO2dX6wkVZnA6wG1weFO7c0oFZjAQZfJITNAOYxQMDgWaLBYUQsxUopigQyeBdGGZOUmd3eLZGenQ3CoYFYrWRcrIRtbH0htMiH1gEklmHijCamQmNQYHsrwUo/1eB5rH87a6Z3p23+qq8+fut8v9QbTdbpu/fo7f77zHa0BAIALmugGAMBBAWQDAE6AbADACZANADgBsh1EyrLMpiiKQnSLDgQg20EhyzJCiGEYmqYhhOwpMMaapum67vt+kiSiW9pbQLaeU1WV7/u6rtu2HUVRVVX7/Z91Xcdx7LruYDDwPA/CXeeAbL2FUhoEAUIojuO6rlf6h+PxGGM8HA5X+ofAfEC2fpKmKUIoCAJKaesPCcOQudpduw40IFsPCcPQcZw5Pcblqeva9/3hcLj+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fYGLhyzrYmjHxbMcqq4onopZSIQQc4spWZZ3e88cFw9pVqxulmiQJEUIVZmz1W5eQpCd7wLExUOebctz8hZWCFEUFf2omLDRRK7vcPG0wzaFoXnl8rbqNf+z2Yx5Z9/xeDyZTNheQ6tw8bRIxS0JeeX+ipIkVczbdMFPmG24jwJcPJ2gyhKlevuqvBuRYi4eTlcYj8fVa234mocCXDy9wbKs6sGrJElqNy0mha7rrNy86MDFs5t0IUfJNktLAS6erkA8K9LES7E5CKGdb1jPxdMVyispwzDc9kakY8qzjiH4gXDxdIWi/e8xtnIsWMD29mUrXTpw8XQF13XXpRRrOITkrCdObCeNdODi6QGWZdV7irN6/AdB0BFDyVbh4ukB5c0/SkjTFABAf0fnzsfZMFw8O47jOMeaLrbNQIadnIunO7S0iYD+4DOQYSfn4ukO69Katm03XPTT9LIZiG8OhounQyz3VyTV7peOCy5NX98uwMXTIZbDuxXbV20EIaSqaquzKQihqqo7H54uwsXTaVRVJWXgBCFUFKUlU4E0TYvNTwcCF0+ngRASnAXhwYG4r0Acx20Pa92Ei2dYZFmm6zrBzCnuCcfEl5Q5XDwdwrZtCjkZhJBt26qqlvSgr0KSJLquD7MbKYaLp0Mc27fcqt0zdk0wDKPGoJGmqW3bsizv9l63jXDxdIii8UAURRXbVzUhCAIAgKIorutujCVACD3PU1VVkqSdr5iuAhdPhyhuInAch5pvUxzHruvKsizLsqZplmW5BWzb1jRNURQAgOM4DSd7uwQXT0fRdZ2+V22SJFEU+b5fFM90Oo2iaIDBtI1w8XA4NeHi4XBqwsXTLUajEUIoDMPBxn97BBdPtwAAfPDBB8xdozhV4OLpFqqqvvbaa8ydcjlV4OLpFpqmPfroo7vtUrszcPF0jvF4vNtegTsDFw+HUxMuHg6nJlw8HE5NuHg4nJpw8XA4NeHi4XBqwsXD4dSEi4fDqQkXD4dTEy4eDqcmXDwcTk24eDicmvx/kcOZrdXY0SEAAAAASUVORK5CYII=" alt="" />
若替换节点无子节点,则1步骤无,使t->parent->left=NULL;
若替换节点的父节点即为需要删除的节点 省略步骤1&4 即
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASsAAADwCAIAAADXSNW7AAAaYElEQVR4nO2dX6zdxJnA/UDbAw03bjYh3iRKB9pkXSUUN2TBS2jqphWYLi1uYYtbKHEoSb2kgKm0y5EurdFulCNEwWq1rVfstpbYVU0fqFdCyC+VZkWlHvFQWUhIJxIPU/XFj36cR++DxdXZ5P4553jsmXG+n+aNXNvncH7+5s833yg1AAD8UHg/AABc14CBAMATMBAAeAIGAgBPwEAA4AkYCAA8AQMBgCdgIADwBAwEAJ6AgQDAEzAQAHgCBl7vEELwHLPZjPcTXV+AgdcjGGPf9zVNUxQFIWTNoeu6oiiqqnqel2UZ7ycdPmDgdURZlp7nqapqWVYcx2VZbvUvq6pKksRxnNFo5LouBMbuAAOvCyilYRgihJIkqapqqT9M01TX9SAIlvpDYEHAwOGT5zlCKAxDSunKF4miqBGY3XMBdQ0GDp4oimzb3qbDuThVVXmeFwRB+0sBG4CBQ8b3febCRFHkOE6bcArMAwYOE0qpbdtxHHdx8SzLTNOEYSETwMBh4vt+R/o15Hlu23Z3179+AAMHSBRFPYzW+rnL4AEDhwbG2LbtfsZpruumadrDjQYMGDgoKKUIISYznwLebpCAgYOi/54h9EVbAgYOBy4RCcJgS8DA4TCZTMbjcf/3hTDYBjBwOCCECCH935dSqqoqrNGvBhg4EIqiMAyD190dx4GtTKsBBg6EMAzDMOR19yRJPM/jdXepAQMHgmEYRVHwuntVVaqq8rq71ICBQ4BSOhqN+D6DruuwkXcFwMAhQAhBCPF9BsuyMMZ8n0FGwMAhgDG2LIvvM3ieB/t3VwAMHAJpmrquy/cZxuPxZDLh+wwyAgYOgTiOfd/n+wx8J2PlBQwcAiIsBoCBqwEGDgEYB8oLGDgEZrOZrut8n8G27TzP+T6DjICBQ0CEBXG+KQHyAgYOBE3TOG4RopRqmga1m1YADBwIXZdm2h4o3LQyYOBA4OsAX/+lBgwcCHz7gXz7wFIDBg4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NjSHDyOEDMOwLMv3/XAO13Uty2r+axiG4myXBPqkz8VeYReWOy/6UBQFxjiO43kD0zTFGMNUJ9BPMXmRF5ah7ArAE0qpaZqddg57SB1pAxgIcIYQ0sWSckNZloJP74GBAH+YLyk3NGlVIutXg4GAIFRVZds2w2V6WdKqwEBAFJqDa9rX45rNZrZty5JWBQYCYjGdTk3TXC2/qixL3/d1XZdobRkMBESkya9acLmYEBJFkWmamqYJte9hEcBAQFw2UqZ0Xbcsy/O8+VVl3/ctyzIMo8mFlLSWLBgISMBsNsMYJ0kyb2Acxxhjwac6dwQMBACegIEAwBMwEAB4AgYCAE/AQADgCRgIADwBAwGAJ2AgAPAEDAQAnoCBAMATMBAAeAIGAgBPwEAA4AkYCAA8AQMBgCdgIADw5P8AQ8JUyJgBLq0AAAAASUVORK5CYII=" alt="" />
完整代码:
void remove(const string &item)
{
stnode *t=search(item); //查找需要删除的节点值 search函数返回类型为stnode
if(t==NULL) return; //leaf node
else if(t->left==NULL&&t->right==NULL)
{
if(t==root)
root=NULL;
else if(t->nodeValue>t->parent->nodeValue)
t->parent->right=NULL;
else
t->parent->left=NULL;
}
//only left or right
else if(t->left==NULL)
{
if(t==root)
{
t->right->parent=NULL;
root=t->right;
}
else if(t->nodeValue>t->parent->nodeValue)
t->parent->right=t->right;
else
t->parent->left=t->right;
t->right->parent=t->parent;
}
else if(t->right==NULL)
{
if(t==root)
{
t->left->parent=NULL;
root=t->left;
}
else if(t->nodeValue>t->parent->nodeValue)
t->parent->right=t->left;
else
t->parent->left=t->left;
t->left->parent=t->parent;
}
//left && right
else
{
AVLnode *r=t;
if(t==root)
{
r=r->right;
while(r->left!=NULL)
r=r->left; r->left=t->left;
t->left->parent=r;
if(r->right==NULL&&r->parent!=root)
{
r->right=t->right;
t->right->parent=r;
r->parent->left=NULL;
}
else if(r->parent!=root)
{
r->parent->left=r->right;
r->right->parent=r->parent;
r->right=t->right;
t->right->parent=r;
} r->parent=NULL;
root=r; } else if(t->nodeValue>t->parent->nodeValue)
{
r=r->right;
while(r->left!=NULL)
r=r->left; if(r->parent!=t)
{
if(r->right==NULL)
r->parent->left=NULL;
else
{
r->right->parent=r->parent;
r->parent->left=r->right;
} r->right=t->right;
t->right->parent=r; r->parent=t->parent;
t->parent->right=r;
r->left=t->left;
t->left->parent=r;
}
else
{
r->parent=t->parent;
t->parent->right=r;
r->left=t->left;
t->left->parent=r;
} }
else
{
r=r->right;
while(r->left!=NULL)
r=r->left; if(r->parent!=t)
{
if(r->right==NULL)
r->parent->left=NULL;
else
{
r->right->parent=r->parent;
r->parent->left=r->right;
} r->right=t->right;
t->right->parent=r; r->parent=t->parent;
t->parent->left=r;
r->left=t->left;
t->left->parent=r;
}
else
{
r->parent=t->parent;
t->parent->left=r;
r->left=t->left;
t->left->parent=r;
} }
}
treeSize--;
delete t;
}
数据结构——二叉搜索树(Binary Search Tree)的更多相关文章
- 编程算法 - 二叉搜索树(binary search tree) 代码(C)
二叉搜索树(binary search tree) 代码(C) 本文地址: http://blog.csdn.net/caroline_wendy 二叉搜索树(binary search tree)能 ...
- 数据结构 《5》----二叉搜索树 ( Binary Search Tree )
二叉树的一个重要应用就是查找. 二叉搜索树 满足如下的性质: 左子树的关键字 < 节点的关键字 < 右子树的关键字 1. Find(x) 有了上述的性质后,我们就可以像二分查找那样查找给定 ...
- [Data Structure] 二叉搜索树(Binary Search Tree) - 笔记
1. 二叉搜索树,可以用作字典,或者优先队列. 2. 根节点 root 是树结构里面唯一一个其父节点为空的节点. 3. 二叉树搜索树的属性: 假设 x 是二叉搜索树的一个节点.如果 y 是 x 左子树 ...
- 二叉搜索树(Binary Search Tree)(Java实现)
@ 目录 1.二叉搜索树 1.1. 基本概念 1.2.树的节点(BinaryNode) 1.3.构造器和成员变量 1.3.公共方法(public method) 1.4.比较函数 1.5.contai ...
- 二叉搜索树(Binary Search Tree)实现及测试
转:http://blog.csdn.net/a19881029/article/details/24379339 实现代码: Node.java //节点类public class Node{ ...
- 【算法与数据结构】二叉搜索树的Java实现
为了更加深入了解二叉搜索树,博主自己用Java写了个二叉搜索树,有兴趣的同学可以一起探讨探讨. 首先,二叉搜索树是啥?它有什么用呢? 二叉搜索树, 也称二叉排序树,它的每个节点的数据结构为1个父节点指 ...
- 用Python实现数据结构之二叉搜索树
二叉搜索树 二叉搜索树是一种特殊的二叉树,它的特点是: 对于任意一个节点p,存储在p的左子树的中的所有节点中的值都小于p中的值 对于任意一个节点p,存储在p的右子树的中的所有节点中的值都大于p中的值 ...
- hdu 3791:二叉搜索树(数据结构,二叉搜索树 BST)
二叉搜索树 Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submiss ...
- 数据结构之二叉搜索树、AVL自平衡树
前言 最近在帮公司校招~~ 所以来整理一些数据结构方面的知识,这些知识呢,光看一遍理解还是很浅的,看过跟动手做过一遍的同学还是很容易分辨的哟~ 一直觉得数据结构跟算法,就好比金庸小说里的<九阳神 ...
- 数据结构之二叉搜索树(BST)--JavaScript实现
原理: 叉排序树的查找过程和次优二叉树类似,通常采取二叉链表作为二叉排序树的存储结构.中序遍历二叉排序树可得到一个关键字的有序序列,一个无序序列可以通过构造一棵二叉排序树变成一个有序序列,构造树的过程 ...
随机推荐
- Linux系统源码安装过程中的prefix选项
在linux和unix环境中,源码安装是最常用的软件安装方式,一些软件除了提供源码外,也提供各种发行版的二进制安装包(如基于redhat包管理工具的rpm包),但强烈建议使用源码安装方式.原因是:(1 ...
- java web分享ppt大纲 -- servlet容器简介
今天在公司分享了java web的ppt,把ppt大纲放在这里,希望可以帮助需要的人 servlet容器简介 定义 狭义上的,servlet容器为java Web应用提供运行时环境,负责管理servl ...
- UVa 1658 Admiral(最小费用最大流)
拆点费用流 --------------------------------------------------------------------- #include<cstdio> # ...
- preg_replace的用法
<?php $str1 = "03/28/2015"; // 要替换成 2015-03-28 echo preg_replace("/([0-1][1-9])\/( ...
- JS数组方法总结
数组的常用方法总结 不改变原数组 1.Array.length; //获取数组长度 2.Array.join(); ...
- javascript 绝对路径工具类
// #region 取虚拟目录示例代码 //获取网站虚拟目录名称 function GetVirtualDirectoryName() { var pathname = removeFirstSla ...
- C#_socket拆包_封包_模拟乱序包
拆包一直是个硬伤呀,MLGB的,服务端各种乱数据,果断整理下 拆包思路:设计一个网络协议,一般都会分包,一个包就相当于一个逻辑上的命令. .如果我们用udp协议,省事的多,一次会收到一个完整的包,但U ...
- objectiveC获取本地时间。
NSDate * date = [NSCalendarDate date]; NSLog(@"%@", date); 日历在IOS里报错,,. NSDateFormatter *f ...
- web api 开发之 filter
1.使用filter之前应该知道的(不知道也无所谓,哈哈!) 谈到filter 不得不先了解下aop(Aspect Oriented Programming)面向切面的编程.(度娘上关于aop一大堆 ...
- [Windows编程] 开发DLL必读《Best Practices for Creating DLLs》
开发DLL的时候,需要十分注意 DllMain 函数,因为在多线程环境下DLLMain里面的代码很容易引发线程死锁. 这篇MSDN文章<Best Practices for Creating D ...