实现平衡二叉排序树的各种算法(包括二叉树的递归遍历和非递归遍历)
最编程
2024-03-02 15:18:02
...
#include<iostream>
#include<cstdlib>
using namespace std;
const int MAXSIZE = 100;
const int OK = 1;
const int ERROR = 0;
typedef int status;
typedef int ElemType;
//平衡二叉排序树的结构
typedef struct Tnode
{
ElemType data;
struct Tnode *lchild,*rchild;
int height; //以该节点为根的子树的高度
}BBTnode,*BBTree;
typedef BBTree Position;
//栈定义
typedef struct
{
BBTree *base,*top; //栈指针成员
int initsize; //栈初始长度
}Stack;
//队列定义
typedef struct
{
BBTree *front,*rear; //队列指针成员
int InitSize; //栈初始长度
}Queue;
//要用到的函数如下
status InsertBBT(BBTree &T,ElemType e); //插入新结点
status CreatStack(Stack &S); //建立栈
status CreatQueue(Queue &Q); //建立队列
status FirstViewRoot(BBTree T); //递归前序遍历
status MiddleViewRoot(BBTree T); //递归中序遍历
status LastViewRoot(BBTree T); //递归后序遍历
status ViewAll(BBTree T); //当经常要遍历时可以用来减少代码量
status NonFirstView(BBTree T,Stack S); //非递归前序遍历
status NonMiddleView(BBTree T,Stack S); //非递归中序遍历
status NonLastView(BBTree T,Stack S); //非递归后序遍历
status NonViewAll(BBTree T,Stack S); //当经常要遍历时可以用来减少代码量
status LevelView(BBTree T,Queue Q); //层次遍历
status FindKeyword(BBTree T,ElemType e);//在二叉树中查找给定关键字(函数返回值为成功1,失败0)
status SwapSubtree(BBTree T); //交换各结点的左右子树
int DeepOfTree(BBTree T); //求二叉树的深度
int TotalNodeNumber(BBTree T); //总的结点数
int LeafNodeNumber(BBTree T); //叶子结点数
status DeleteBBT(BBTree &T,ElemType e); //删除某结点
//以下函数是为了实现我的平衡树算法而设计
Position FindMin(BBTree T); //找最小的Element
int Height(BBTree T); /*求树的高度(以空树为-1,并定义树的高度为树的层次数减1,如只有一个
节点的树的高度为0,两层的树高度为1)*/
int Max(int l,int r); //求较大的数
BBTree LL_SingleRotate(BBTree k2); //向左旋转一次
BBTree RR_SingleRotate(BBTree k1); //向右旋转一次
BBTree LR_DoubleRotate(BBTree k3); //向左转一次,向右转一次
BBTree RL_DoubleRotate(BBTree k1); //向右转一次,向左转一次
int main()
{
int i,n,chose,cnt=0;
char c;
ElemType keyword,e,delKey;
Stack S;
Queue Q;
BBTree T = NULL;
cout << "Please input the number of Elements: ";
cin >> n;
cout << "Now,please input " << n << " Elements:\n";
for(i=0;i<n;i++)
{
cin >> e;
InsertBBT(T,e);
}
do
{
cout << "\nPlease chose one from these:\n";
cout << " 1.插入新结点\n"
<< " 2.前序、中序、后序遍历二叉树(递归)\n"
<< " 3.前序、中序、后序遍历的非递归算法\n"
<< " 4.层次遍历二叉树\n"
<< " 5.在二叉树中查找给定关键字\n"
<< " 6.交换各结点的左右子树\n"
<< " 7.求二叉树的深度\n"
<< " 8.叶子结点数\n"
<< " 9.删除某结点\n"
<< " 0.退出\n";
cin >> chose;
switch(chose)
{
case 1:
cout << "Please input one Element you want to insert: ";
cin >> e;
if(InsertBBT(T,e) == OK)
cout << "*** The Element " << e << " inserted successfully! ***\n";
else
cout << "*** The Element " << e << " failed to insert! ***\n";
break;
case 2:
//以下是递归遍历
cout << "\nThe recursive traversal are follow:\n";
ViewAll(T);
break;
case 3:
//以下是非递归遍历
cout << "\nThe non-recursive traversal are follow:\n";
NonViewAll(T,S);
break;
case 4:
//以下是层次遍历
cout << "the LevelView is:\n";
CreatQueue(Q);
LevelView(T,Q);
cout << "\n";
break;
case 5:
//在二叉树中查找给定关键字
cout << "Please input the keyword you want to find in the tree: ";
cin >> keyword;
if(FindKeyword(T,keyword) == OK)
cout << "*** The keyword " << keyword << " found successfully! ***\n";
else
cout << "*** The keyword " << keyword << " not found! ***\n";
break;
case 6:
//交换各结点的左右子树
SwapSubtree(T);
break;
case 7:
//求二叉树的深度
cout << "\nThe deep of the tree is: ";
cout << DeepOfTree(T) <<endl;
break;
case 8:
//叶子结点数
cout << "\nThe number of leaves is: ";
cout << LeafNodeNumber(T) <<endl;
cout << "And the total number of nodes is: ";
cout << TotalNodeNumber(T) <<endl;
break;
case 9:
//删除某结点
cout << "Please input the Element you want to Delete: ";
cin >> delKey;
if(DeleteBBT(T,delKey) == OK)
{
cout << "*** The Element " << delKey << " Deleted successfully! ***\n";
}
else
{
cout << "*** Failed to Delete!Because the element not found! ***\n";
}
break;
case 0:return 0;break;
default:
cout << "\a***Command Not Vilid!!!***\n";
break;
}
cout << "\nContinue...?(please answer y or n). "
<< "if you answer y,\nthen will continue,others will exit!\n"
<< "Your answer is: ";
cin >> c;
}while(c == 'y');
return 0;
}
/*---------------------以下是InsertBBT和DeleteBBT所需函数-------------------------*/
status InsertBBT(BBTree &T,ElemType e) //插入新结点
{
if(T == NULL) //空树,建一个节点给树
{
T = (BBTree)malloc(sizeof(BBTnode));
if(!T) return ERROR;
T->data = e;
T->lchild = T->rchild = NULL;
T->height = 0;
}
else if(e < T->data) //向左插入
{
InsertBBT(T->lchild,e);
if(Height(T->lchild) - Height(T->rchild) == 2) //出现不平衡了
{
//如果用序列(5,2,1...)就可会出现LL型,用序列(5,2,3...)就可会出现LR型
if(e < T->lchild->data) //这样对应于 LL 型
T = LL_SingleRotate(T);
else //这个对应于 LR 型
T = LR_DoubleRotate(T);
}
}
else if(e > T->data) //向右插入
{
InsertBBT(T->rchild,e);
if(Height(T->rchild) - Height(T->lchild) == 2) //出现不平衡了
{
//如果用序列(5,6,7...)就可会出现RR型,用序列(5,7,6...)就可会出现RL型
if(e > T->rchild->data) //这样对应于 RR 型
T = RR_SingleRotate(T);
else //这样对应于 RL 型
T = RL_DoubleRotate(T);
}
}
//如果 e == T->data 的话什么也不干,最后要记录T->height
T->height = Max(Height(T->lchild),Height(T->rchild)) + 1;
return OK;
}
status DeleteBBT(BBTree &T,ElemType e) //删除某结点
{
Position temp;
if(T == NULL) return ERROR;
else if(e < T->data)
return DeleteBBT(T->lchild,e);
else if(e > T->data)
return DeleteBBT(T->rchild,e);
else //即 e == T->data的情况
{
if(T->lchild != NULL && T->rchild !=NULL) //有两个孩子
{
temp = FindMin(T->rchild);
T->data = temp->data;
DeleteBBT(T->rchild,T->data); //删除右边刚刚找出的最小的节点
}
else //有一个或者没有孩子
{
temp = T;
if(T->lchild == NULL) //也处理了0个孩子的情况
T = T->rchild;
else if(T->rchild == NULL)
T = T->lchild;
free(temp);
}
return OK;
}
}
Position FindMin(BBTree T) //找最小的Element
{
if(T == NULL) return NULL;
else if(T->lchild == NULL) return T;
else return FindMin(T->lchild);
}
int Height(BBTree T) //求树的高度
{
if(T == NULL) return -1;
else return T->height;
}
int Max(int l,int r) //求较大的数
{
return l>r?l:r;
}
BBTree LL_SingleRotate(BBTree k2) //向左旋转一次,抓住k1(小的),让重力话事
{
BBTree k1;
k1 = k2->lchild;
k2->lchild = k1->rchild;
k1->rchild = k2;
k1->height = Max(Height(k1->lchild),k2->height) + 1;
k2->height = Max(Height(k2->lchild),Height(k2->rchild)) +1;
return k1; //新的root
}
BBTree RR_SingleRotate(BBTree k1) //向右旋转一次,抓住k2(大的),让重力话事
{
BBTree k2;
k2 = k1->rchild;
k1->rchild = k2->lchild;
k2->lchild = k1;
k1->height = Max(Height(k1->lchild),Height(k1->rchild)) +1;
k2->height = Max(Height(k1->rchild),k1->height) + 1;
return k2; //新的root
}
BBTree LR_DoubleRotate(BBTree k3) //向左转一次,向右转一次
{
k3->lchild = RR_SingleRotate(k3->lchild); //先逆时针转
return LL_SingleRotate(k3); //再顺时针转
}
BBTree RL_DoubleRotate(BBTree k1) //向右转一次,向左转一次
{
k1->rchild = LL_SingleRotate(k1->rchild); //先顺时针转
return RR_SingleRotate(k1); //再逆时针转
}
/*--------------------以上是InsertBBT和DeleteBBT所需函数-------------------------*/
status CreatStack(Stack &S) //建立栈
{
S.base = (BBTree *)malloc(MAXSIZE * sizeof(BBTree));
if(!S.base) return ERROR;
S.top = S.base;
S.initsize = MAXSIZE;
return OK;
}
status CreatQueue(Queue &Q) //建立队列
{
Q.front = (BBTree *)malloc(MAXSIZE * sizeof(BBTree));
if(!Q.front) return ERROR;
Q.rear = Q.front;
Q.InitSize = MAXSIZE;
return OK;
}
status FirstViewRoot(BBTree T) //递归前序遍历
{
if(T != NULL)
{
cout << T->data << " ";
FirstViewRoot(T->lchild);
FirstViewRoot(T->rchild);
}
return OK;
}
status MiddleViewRoot(BBTree T) //递归中序遍历
{
if(T != NULL)
{
MiddleViewRoot(T->lchild);
cout << T->data << " ";
MiddleViewRoot(T->rchild);
}
return OK;
}
status LastViewRoot(BBTree T) //递归后序遍历
{
if(T != NULL)
{
LastViewRoot(T->lchild);
LastViewRoot(T->rchild);
cout << T->data << " ";
}
return OK;
}
status ViewAll(BBTree T)
{
cout << "the FirstViewRoot is:\n";
FirstViewRoot(T);
cout << "\n";
cout << "the MiddleViewRoot is:\n";
MiddleViewRoot(T);
cout << "\n";
cout << "the LastViewRoot is:\n";
LastViewRoot(T);
cout << "\n";
return OK;
}
status NonFirstView(BBTree T,Stack S) //非递归前序遍历
{
while(S.base != S.top || T != NULL)
{
while(T != NULL) //向左走到最左
{
cout << T->data << " "; //输出元素
*S.top++ = T;
T = T->lchild;
}
T=*--S.top; //出栈
T = T->rchild; //转向右
}
return OK;
}
status NonMiddleView(BBTree T,Stack S) //非递归中序遍历
{
while(S.base != S.top || T != NULL)
{
while(T != NULL) //向左走到最左
{
*S.top++ = T;
T = T->lchild;
}
T=*--S.top; //出栈
cout << T->data << " "; //输出元素
T = T->rchild; //转向右
}
return OK;
}
status NonLastView(BBTree T,Stack S)
{
BBTree pre = NULL;
while(S.base != S.top || T != NULL)
{
while(T != NULL) //向左走到最左
{
*S.top++ = T;
T = T->lchild;
}
T=*(S.top - 1); //取栈顶节点
if(T->rchild == NULL || T->rchild == pre) //如果T没有右孩子或者其右孩子刚刚被访问过
{
cout << T->data << " "; //输出元素
S.top--;
pre = T;
T = NULL;
}
else
T = T->rchild; //转向右
}
return OK;
}
status NonViewAll(BBTree T,Stack S)
{
cout << "the FirstViewRoot is:\n";
CreatStack(S);
NonFirstView(T,S);
cout << "\n";
cout << "the MiddleViewRoot is:\n";
CreatStack(S);
NonMiddleView(T,S);
cout << "\n";
cout << "the LastViewRoot is:\n";
CreatStack(S);
NonLastView(T,S);
cout << "\n";
return OK;
}
status LevelView(BBTree T,Queue Q) //层次遍历
{
if(T != NULL)
{
*Q.rear++ = T;
while(Q.front != Q.rear) //队列不空时
{
if(T->lchild != NULL) *Q.rear++ = T->lchild; //左子树进队
if(T->rchild != NULL) *Q.rear++ = T->rchild; //右子树进队
T = *Q.front++; //出队
cout << T->data << " ";
T = *Q.front; //最新的队头
}
}
return OK;
}
status FindKeyword(BBTree T,ElemType e) //在二叉树中查找给定关键字(函数返回值为成功1,失败0)
{
if(T!=NULL)
{
if(e == T->data) return OK;
else if(e < T->data) return FindKeyword(T->lchild,e);
else return FindKeyword(T->rchild,e);
}
else return ERROR;
}
status SwapSubtree(BBTree T) //交换各结点的左右子树
{
BBTree tmpNode;
if(T != NULL)
{
tmpNode = T->lchild;
T->lchild = T->rchild;
T->rchild = tmpNode;
SwapSubtree(T->lchild);
SwapSubtree(T->rchild);
}
return OK;
}
int DeepOfTree(BBTree T) //求二叉树的深度
{
int deep,ldeep = 0,rdeep = 0;
if(T != NULL)
{
ldeep = DeepOfTree(T->lchild);
rdeep = DeepOfTree(T->rchild);
deep = Max(ldeep,rdeep) + 1;
}
else return 0;
return deep;
}
int TotalNodeNumber(BBTree T) //总的结点数
{
int sum = 0,lsum = 0,rsum = 0;
if(T != NULL)
{
lsum = TotalNodeNumber(T->lchild);
rsum = TotalNodeNumber(T->rchild);
sum = lsum + rsum + 1;
return sum;
}
else return 0;
}
int LeafNodeNumber(BBTree T) //叶子结点数
{
int cnt = 0,lcnt = 0,rcnt = 0;
if(T != NULL)
{
if(T->lchild == NULL && T->rchild == NULL) cnt=1;
else
{
lcnt = LeafNodeNumber(T->lchild);
rcnt = LeafNodeNumber(T->rchild);
cnt = lcnt + rcnt;
}
}
else return 0;
return cnt;
}
推荐阅读
-
二叉树遍历的递归和非递归算法
-
[姿势估计] 实践记录:使用 Dlib 和 mediapipe 进行人脸姿势估计 - 本文重点介绍方法 2):方法 1:基于深度学习的方法:。 基于深度学习的方法:基于深度学习的方法利用深度学习模型,如卷积神经网络(CNN)或递归神经网络(RNN),直接从人脸图像中学习姿势估计。这些方法能够学习更复杂的特征表征,并在大规模数据集上取得优异的性能。方法二:基于二维校准信息估计三维姿态信息(计算机视觉 PnP 问题)。 特征点定位:人脸姿态估计的第一步是通过特征点定位来检测和定位人脸的关键点,如眼睛、鼻子和嘴巴。这些关键点提供了人脸的局部结构信息,可用于后续的姿势估计。 旋转表示:常见的旋转表示方法包括欧拉角和旋转矩阵。欧拉角通过三个旋转角度(通常是俯仰、偏航和滚动)描述头部的旋转姿态。旋转矩阵是一个 3x3 矩阵,表示头部从一个坐标系到另一个坐标系的变换。 三维模型重建:根据特征点的定位结果,三维人脸模型可用于姿势估计。通过将人脸的二维图像映射到三维模型上,可以估算出人脸的旋转和平移信息。这就需要建立人脸的三维模型,然后通过优化方法将模型与特征点对齐,从而获得姿势估计结果。 特征点定位 特征点定位是用于检测人脸关键部位的五官基础部分,还有其他更多的特征点表示方法,大家可以参考我上一篇文章中介绍的特征点检测方案实践:人脸校正二次定位操作来解决人脸校正的问题,客户在检测关键点的代码上略有修改,坐标转换部分客户见上图 def get_face_info(image). img_copy = image.copy image.flags.writeable = False image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) results = face_detection.process(image) # 在图像上绘制人脸检测注释。 image.flags.writeable = True image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) box_info, facial = None, None if results.detections: for detection in results. for detection in results.detections: mp_drawing.Drawing.detection = 无 mp_drawing.draw_detection(image, detection) 面部 = detection.location_data.relative_keypoints 返回面部 在上述代码中,返回的数据是五官(6 个关键点的坐标),这是用 mediapipe 库实现的,下面我们可以尝试用另一个库:dlib 来实现。 使用 dlib 使用 Dlib 库在 Python 中实现人脸关键点检测的步骤如下: 确保已安装 Dlib 库,可使用以下命令: pip install dlib 导入必要的库: 加载 Dlib 的人脸检测器和关键点检测器模型: 读取图像并将其灰度化: 使用人脸检测器检测图像中的人脸: 对检测到的人脸进行遍历,并使用关键点检测器检测人脸关键点: 显示绘制了关键点的图像: 以下代码将参数 landmarks_part 添加到要返回的关键点坐标中。
-
反传销网8月30日发布:视频区块链里的骗子,币里的韭菜,杜子建骂人了!金融大V周召说区块链!——“一小帮骗子玩一大帮小白,被割韭菜,小白还轮流被割,割的就是你!” 什么区块链,统统是骗子 作者:周召(知乎金融领域大V,毕业于上海财经大学,目前任职上海某股权投资基金合伙人) 有人问我,区块链现在这么火,到底是不是骗局? 我的回答是: 是骗局。而且我并不是说数字货币是骗局,而是说所有搞区块链的都是骗局。 -01- 区块链是一种鸡肋技术 人类社会任何技术的发明应用,本质都是为了提高社会的生产效率。而所谓区块链技术本质不过是几种早已成熟的技术的大杂烩,冗余且十分低效,除了提高了洗钱和诈骗的效率以外,对人类社会的进步毫无贡献。 真正意义上的区块链得包含三个要素:分布式系统(包括记账和存储),无法篡改的数据结构,以及共识算法,三者互为基础和因果,就像三体世界一样。看上去挺让人不明觉厉的,而经过几年的瞎折腾,稍微懂点区块链的碰了几次壁后都已经渐渐明白区块链其实并没有什么卵用,区块链技术已经名存实亡,沦为了营销工具和传销组织的画皮。 因为符合上述定义的、以比特币为代表的原教旨区块链技术,是反效率的,从经济学角度来说,不但不是一种帕累托改进,甚至还可以说是一种帕累托倒退。 原教旨区块链技术的效率十分低下,因为要遍历所有节点,只能做非常轻量级的数据应用,一旦涉及到大量的数据传输与更新,区块链就瞎了。 一方面整条链交易速度会极慢,另一方面数据库容量极速膨胀,考虑到人手一份的存储机制,区块链其实是对存储资源和能源的一种极大的浪费。 这里还没有加上为了取得所谓的共识和挖矿消耗的巨大的能源,如果说区块链技术是屎,那么这波区块链投机浪潮可谓人类历史上最大规模的搅屎运动。 区块链也验证不了任何东西。 所谓的智能合约,即不智能,也非合约。我看有人还说,如果有了智能合约,就可以跟老板签一份放区块链上,如果明年销售业绩提升30%,就加薪10%,由于区块链不能篡改,不能抵赖,所以老板必须得执行,说得有板有眼,不懂行的愣一看,好像还真是那么回事。 但仔细一想,问题就来了。首先,在区块链上如何证明你真的达到了30%业绩提升?即便真的达到老板耍赖如何执行? 也就是说,如果区块链真这么厉害,要法院和仲裁干什么。 人类社会真正的符合成本效益原则的是代理制度。之前有人说要用区块链改造注册会计师行业,我不知道他准备怎么设计,我猜想他思路大概是这样的,首先肯定搞去中心化,让所有会计师到链上来,然后一个新人要成为注册会计师就要所有会计师同意并记录在链上。 那我就请问了,我每天上班累死累活,为什么还要花时间去验证一个跟我无关的的人的专业能力?最优做法当然是组织一个委员会,让专门的人来负责,这不就是现在注册会师协会干的事儿吗?区块链的逻辑相当于什么事情都要拿出来公投,这个绝对是扯淡的。 当然这么说都有点抬举区块链了,区块链技术本身根本没有判断是非能力,如果这么高级的人工智能,靠一个无脑分布式记账就能实现的话,我们早就进入共产主义社会了。 虽然EOS等数字货币采用了超级节点,通过再中心化的方式提高效率,有点行业协会的意思,是对区块链原教旨主义的一种修正,但是依然无法突破区块链技术最本质的局限性。有人说,私有链和联盟链是区块链技术的未来,也是扯淡,因为区块链技术没有未来。如果有,说明他是包装成区块链的伪区块链技术。 区块链所涉及的所有底层技术,不管是分布式数据库技术,加密技术,还是点对点传输技术等,基本都是早已存在没什么秘密可言的技术。 比特币系统最重要的特性是封闭性和自洽性,他验证不了任何系统自身以外产生的信息的真实性。 所谓系统自身产生的信息,就是数据库数据的变动信息,有价值的基本上有且只有交易信息。所以说比特币最初不过是中本聪一种炫技的产物,来证明自己对几种技术的掌握,你看我多牛逼,设计出了一个像三体一样的系统。因此,数字货币很有可能是区块链从始至终唯一的杀手应用。 比特币和区块链概念从诞生到今天已经快10年了,很多人说区块链技术在爆发的前夜,但这个前夜好像是不是有点过长了啊朋友,跟三体里的长夜有一拼啊。都说区块链技术像是90年代初的互联网,可是90年代初的互联网在十年发展后,已经出现了一大批伟大的公司,阿里巴巴在99年都成立了,区块链怎么除了币还是币呢? 正规的数字货币未来发展的形式无外乎几种,要么就是论坛币形式,或者类似股票的权益凭证等。问题是论坛币和股票之前,本来也都电子化了,区块链来了到底改变了什么呢? 所有想把TOKEN和应用场景结合起来的人最后都很痛苦,最后他们会发现区块链技术就是脱裤子放屁,自己辛苦搞半天,干嘛不自己作为中心关心门来收钱?最后这些人都产生了价值的虚无感,最终精神崩溃,只能发币疯狂收割韭菜,一边嘴里还说着我是个好人之类的奇怪的话。 因此,之前币圈链圈还泾渭分明,互相瞧不起,但这两年链圈逐渐坐不住了,想着是不是趁着泡沫没彻底破灭之前赶快收割一波,不然可能什么都捞不着了。 前段时间和一个名校毕业的链圈朋友瞎聊天,他说他们“致力于用区块链技术解决数字版权保护问题”,我就问他一个问题,你们如何保证你链的版权所有权声明是真实的,万一盗版者抢先一步把数据放在链上怎么办。他说他们的解决方案是连入国家数字版权保护中心的数据库进行验证…… 所以说区块链技术就是个鸡肋,研究到最后都会落入效率与真实性的黑洞,很多人一头扎进链圈后才发现,真正意义上的区块链技术,其实什么都干不了。 -02- 不是蠢就是坏的区块链媒体 空气币和区块链的造富神话,让区块链自媒体也开始迎风乱扭。一群群根本不知道区块链为何物的妖魔鬼怪纷纷进驻区块链自媒体战场,开始大放厥词胡编乱造。 任何东西,但凡只要和区块,链,分,分布式,记账,加密,验证,可追溯等等这些个关键词沾到哪怕一点点,这些所谓的区块链媒体人就会像狗闻到了屎了一样疯狂地把区块链概念往上套。 这让我想起曾经一度也是热闹非凡的物联网,我曾经去看过江苏一家号称要改变世界的“物联网”企业,过去一看是生产路由器的,我黑人问号脸,对方解释说没有路由器万物怎么互联,我觉得他说得好有道理,竟无言以对。 好,下面让我们进入奇葩共赏析时间,来看看区城链媒体经常有哪些危言耸听的奇谈怪论 区块链(分布式记账)的典型应用是*?? 正如前面所说,真正意义上的区块链分布式记账,不光包括“记”这个动作,还包括分布式存储和共识机制等。而*诞生远远早于区块链这个词的出现,勉强算是“分布式编辑”吧,就被很多区块链媒体拿来强行充当区块链技术应用的典范。 其实事实恰恰相反,*恰恰是去中心化失败的典范,现在如果没有精英和专业人士的编辑和维护,*早就没法看了。 区块链会促进社会分工?? 罗振宇好像就说过类似的话,虽然罗振宇说过很多没有逻辑的话,但这句话绝对是最没逻辑思维的。很多区块链自媒体也常常用这句话来忽悠老百姓,说分工代表效率提高社会进步,而区块链“无疑”会促进分工,他们的理由仅仅是分工和分布式记账都共用一个“分”字,就强行把他们扯到一起。 实际情况恰恰相反,区块链是逆分工的,区块链精神是号召所有人积极地参与到他不擅长也不想掺合的事情里面去。 区块链不能像上帝一样许诺他的子民死后上天国,只能给他们许诺你们是六度人脉中的第一级,我可以赚后面五级人的钱,你处于金字塔的顶端。
-
实现平衡二叉排序树的各种算法(包括二叉树的递归遍历和非递归遍历)