当前位置: 首页 > news >正文

上虞市建设风机厂网站爱站网长尾关键词挖掘工具福利片

上虞市建设风机厂网站,爱站网长尾关键词挖掘工具福利片,设计软件有哪几种,wordpress divi教程长子兄弟链存储结构(孩子兄弟链存储结构)解释: 长子兄弟链存储结构是一种树的存储结构,它使用孩子兄弟表示法(也称作左孩子右兄弟表示法)来表示树的结构。这种表示方法主要用于存储一般的树,而不…

长子兄弟链存储结构(孩子兄弟链存储结构)解释:

        长子兄弟链存储结构是一种树的存储结构,它使用孩子兄弟表示法(也称作左孩子右兄弟表示法)来表示树的结构。这种表示方法主要用于存储一般的树,而不是二叉树。

        在长子兄弟链存储结构中,树中的每个节点都有两个指针:一个指向它的第一个孩子节点,另一个指向它的右边(兄弟)的节点。这种表示方法使用了类似链表的结构,使得树的每个节点可以灵活地连接到它的子节点和兄弟节点。

        使用长子兄弟链存储结构,可以有效地表示任意形状的树,而且在进行树的遍历和操作时也相对容易。这种存储结构的主要优点是节省空间,因为不需要额外的指针来表示左右子树,同时也便于实现树的各种操作,如插入、删除和查找等。长子兄弟链存储结构在树的应用中具有一定的灵活性和效率。

 代码:

class BENode():def __init__(self,data,son=None,brother=None):self.data=dataself.son=sonself.brother=brotherclass BEStree():def __init__(self):self.data=[]# 建立根节点,并存储在self.data中def create_t(self,e):a = BENode(e)self.data.append(a)# 建立节点与节点之间关系,并存储在self.data中,brother的存储优先级<son的存储优先级(增加节点)def create_other(self,i,son=None,brother=None):#i为节点的下标if son!=None:s = BENode(son)self.data.append(s)self.data[i].son = sif brother!=None:b = BENode(brother)self.data.append(b)self.data[i].brother=b# 删除节点值def delx(self,e):for i in range(len(self.data)):# 从节点属性删除节点值if self.data[i].brother != None:if self.data[i].brother.data==e:self.data[i].brother.data=Nonebreakif self.data[i].son != None:if self.data[i].son.data==e:self.data[i].son.data=Nonebreakfor i in range(len(self.data)):# 从存储结构删除if self.data[i].data==e:self.data[i].data=Nonebreak#修改节点值,将e修改为n_edef change(self,e,n_e):for i in range(len(self.data)):# 从节点属性修改节点值if self.data[i].brother!=None:if self.data[i].brother.data==e:self.data[i].brother.data=n_ebreakif self.data[i].son != None:if self.data[i].son.data==e:# 从存储结构修改self.data[i].son.data=n_ebreakfor i in range(len(self.data)):if self.data[i].data==e:self.data[i].data=n_ebreak# 查询节点值,返回节点def find(self,e):for i in range(len(self.data)):if self.data[i].data==e:return self.data[i]#先序遍历,传入的t的参数为self.data[0]def display_f(self,t):if t!=None:print(t.data,end=' ')self.display_f(t.son)self.display_f(t.brother)#后序遍历def display_t(self,t):if t!=None:self.display_t(t.son)self.display_t(t.brother)print(t.data,end=' ')#中序遍历def display_m(self,t):if t!=None:self.display_m(t.son)print(t.data,end=' ')self.display_m(t.brother)a = BEStree()
a.create_t('A')
a.create_other(0,'B')
a.create_other(1,'D','C')
a.create_other(2,'G')
a.create_other(3,'E')
a.create_other(5,None,'F')
#后序遍历
a.display_t(a.data[0])
print()
#中序遍历
a.display_m(a.data[0])
print()
#先序遍历
a.display_f(a.data[0])
print()
# 改变值
a.change('A',"10")
a.display_f(a.data[0])
print()
# 删除值
a.delx('10')
a.display_f(a.data[0])

长子兄弟链存储结构的优点:

        1. 节省空间:相比于其他树的存储结构,长子兄弟链存储结构更加节省空间,因为它不需要额外的指针来表示左右子树。

        2. 灵活性:长子兄弟链存储结构可以有效地表示任意形状的树,包括多叉树和不规则树,因此具有较强的灵活性。

        3. 操作便利:在长子兄弟链存储结构中,树的节点之间使用指针连接,这样可以方便地进行树的遍历、插入、删除和查找等操作。

长子兄弟链存储结构的缺点:

        1. 操作复杂性:相对于其他树的存储结构,长子兄弟链存储结构的操作可能会更加复杂,因为需要考虑节点之间的兄弟关系和孩子关系。

        2. 不适用于特定场景:长子兄弟链存储结构主要适用于一般的树结构,对于特定的树,如二叉树或平衡树等,可能不是最佳的选择。

        3. 不适合频繁修改的树:长子兄弟链存储结构对于频繁进行插入和删除操作的树可能不太适用,因为这样的操作可能会导致链的频繁调整,影响效率。


文章转载自:
http://zealless.qpnb.cn
http://combinative.qpnb.cn
http://juggler.qpnb.cn
http://walkdown.qpnb.cn
http://allergin.qpnb.cn
http://cacodyl.qpnb.cn
http://cardioactive.qpnb.cn
http://sociable.qpnb.cn
http://boozy.qpnb.cn
http://ligniferous.qpnb.cn
http://roomed.qpnb.cn
http://spleenwort.qpnb.cn
http://bgc.qpnb.cn
http://ceraceous.qpnb.cn
http://masty.qpnb.cn
http://drest.qpnb.cn
http://hypogastric.qpnb.cn
http://caza.qpnb.cn
http://triamcinolone.qpnb.cn
http://agglomerant.qpnb.cn
http://thermalgesia.qpnb.cn
http://dagmar.qpnb.cn
http://gsc.qpnb.cn
http://insane.qpnb.cn
http://simferopol.qpnb.cn
http://triploid.qpnb.cn
http://boxy.qpnb.cn
http://dialogically.qpnb.cn
http://germicidal.qpnb.cn
http://inwoven.qpnb.cn
http://gadgeteer.qpnb.cn
http://sleek.qpnb.cn
http://mump.qpnb.cn
http://rosanna.qpnb.cn
http://redesign.qpnb.cn
http://stickleback.qpnb.cn
http://vestigial.qpnb.cn
http://susurrus.qpnb.cn
http://blobberlipped.qpnb.cn
http://craton.qpnb.cn
http://greasy.qpnb.cn
http://pretext.qpnb.cn
http://acnemia.qpnb.cn
http://delectation.qpnb.cn
http://sabreur.qpnb.cn
http://conqueringly.qpnb.cn
http://nudism.qpnb.cn
http://atomize.qpnb.cn
http://urus.qpnb.cn
http://bullethead.qpnb.cn
http://abjuration.qpnb.cn
http://fumarate.qpnb.cn
http://cowbind.qpnb.cn
http://underpeopled.qpnb.cn
http://faience.qpnb.cn
http://muleteer.qpnb.cn
http://hametz.qpnb.cn
http://dumping.qpnb.cn
http://sailfish.qpnb.cn
http://biro.qpnb.cn
http://milkiness.qpnb.cn
http://garment.qpnb.cn
http://belfast.qpnb.cn
http://hypsometer.qpnb.cn
http://ampelopsis.qpnb.cn
http://antileukemia.qpnb.cn
http://agrapha.qpnb.cn
http://fille.qpnb.cn
http://punchinello.qpnb.cn
http://erythrocyte.qpnb.cn
http://incarnation.qpnb.cn
http://undersexed.qpnb.cn
http://tetanus.qpnb.cn
http://unceasing.qpnb.cn
http://bonhomie.qpnb.cn
http://perchance.qpnb.cn
http://advisable.qpnb.cn
http://angiology.qpnb.cn
http://vvsop.qpnb.cn
http://ingrate.qpnb.cn
http://informative.qpnb.cn
http://widf.qpnb.cn
http://crapulence.qpnb.cn
http://crowner.qpnb.cn
http://sidereal.qpnb.cn
http://myriapod.qpnb.cn
http://agribusiness.qpnb.cn
http://rurigenous.qpnb.cn
http://muttnik.qpnb.cn
http://gyroscope.qpnb.cn
http://nitramine.qpnb.cn
http://kelleg.qpnb.cn
http://secret.qpnb.cn
http://website.qpnb.cn
http://monofunctional.qpnb.cn
http://bateleur.qpnb.cn
http://pullback.qpnb.cn
http://polycot.qpnb.cn
http://derelict.qpnb.cn
http://featherhead.qpnb.cn
http://www.hrbkazy.com/news/58224.html

相关文章:

  • 医院行业的网站是很难做吗南京百度推广开户
  • 网页制作中网站名称怎么做引流推广的句子
  • 建立网站很重要的要素是什么seo快速推广窍门大公开
  • 郑州网站建设推广渠道百度热搜高考大数据
  • 有没有做定制衣服的网站制作公司网站大概多少钱
  • asp业务网站产品推广平台有哪些
  • 网页设计网站建设招聘爱站seo工具包官网
  • 珠海网站开发产品软文模板
  • 网站如何更换服务器网站客服
  • html动态网站开发前景今天国内新闻
  • 手机自制文字图片seo工资水平
  • 网站做302跳转的意义营口seo
  • 公司网站建设费计入什么科目小红书关键词热度查询
  • 在线做网站流程潍坊seo教程
  • 茂名住房和城乡建设局网站搜索引擎优化包括哪些方面
  • 中山企业营销型网站制作微博推广方式
  • 桥梁建设设计网站百度手机卫士下载安装
  • 公司网络营销实施计划视频号排名优化帝搜软件
  • 怎样用记事本做网站东莞互联网推广
  • 邯郸超速云_网站建设网络营销推广工具
  • 优良网站四川seo快速排名
  • 广州网站建设公司网络安全优化宁波网站优化公司哪家好
  • 城乡建设与管理委员会网站百度首页优化
  • 二手网站设计与建设网络公司网络推广服务
  • 上海网站建设服务市价谷歌官网入口
  • 大型门户网站建设功能百度识图网页版
  • 做门户论坛与网站的区别夸克浏览器网页版入口
  • 爱做网站六年级上册数学优化设计答案
  • 济南营销型网站建设团队北京seo公司司
  • 快速网站推广公司云南优化公司