随笔分类 - Datastruct
平衡二叉树的创建
摘要:/*----------------------------------------------------*/ PTree avl_insert_tree(PTree _root, int value) { PTree temp = _root; PTree pa=NULL,pre=NULL; insert_tree_loop(_root,va...
阅读全文
二叉树的层次遍历
摘要:typedef struct qnode { PTree data[MAXSIZE]; int front; int rear; }Queue,*PQueue; /*----------------------------------------------------*/ PQueue init_queue() { P...
阅读全文
二叉树的三种遍历方式
摘要:1、DLR void perorder(PTree _root) { if(NULL !=root) { printf("%d ",root->data);// data is integer perorder(root->lchild); perorder(root->rchild); } } 2、LDR v...
阅读全文
二叉排序树的插入、删除操作(递推方式)
摘要:/*------------tree insert use loop search-----------------------------*/ void insert_tree_loop(PTree _root, int value) { while(NULL !=_root) { if(value == _root->data) { return; } else if(value < _root->data) { if(NULL == _root->lchild)//find node insert new node { _root->lchild = cre
阅读全文
排序二叉树的插入、删除操作(递归方式)。
摘要:/*------------------------------------------------------------------*/typedef struct node{ int data; struct node* lchild; struct node* rchild;}Tree,*PTree;//data of tree struct /*------------------------------------------------------------------*/PTree create_node(int value){ PTree new_node=NULL...
阅读全文
浙公网安备 33010602011771号