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

  树的运算:

  • 寻找某节点
  • 插入、删除某节点
  • 遍历树中每个节点
  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;

 

posted @ 2018-02-10 12:17  mtcz91  阅读(367)  评论(0)    收藏  举报