码迷,mamicode.com
首页 > 其他好文 > 详细

数据结构之树的基本运算和存储结构

时间:2018-02-10 14:02:43      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:tree   ons   pos   blog   bsp   size   max   class   body   

  树的运算:

  • 寻找某节点
  • 插入、删除某节点
  • 遍历树中每个节点
  1. 先根遍历
  2. 后根遍历
  3. 层次遍历

  树的存储结构:

   1.双亲存储结构

typedef struct
{
    ElemType data;
    int parent;        
}PTree[Maxsize];

  2.孩子链存储结构

typedef struct node
{
    ElemType data;
    struct node *sons[MaxSons];  
}TSonNode;

  3.孩子兄弟链存储结构

typedef struct tnode
{
  ElemType data;
  struct tnode *hp;//指向兄弟
  struct tnode *vp;//指向孩子
}TSBNode;

 

数据结构之树的基本运算和存储结构

标签:tree   ons   pos   blog   bsp   size   max   class   body   

原文地址:https://www.cnblogs.com/mtcz91/p/8438459.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!