摘要: //单链表的直接插入排序 void InsertSort(LinkList &L){ LNode *p=L->next; LNode *q,*r; if(p!=null){//原单链表中有一个或多个结点 r=p->next;//保存p结点的后继结点 p->next=null; p=r; while( 阅读全文
posted @ 2019-12-25 10:55 ZzUuOo666 阅读(679) 评论(0) 推荐(0) 编辑
摘要: //二叉排序树 //从大到小输出>=k的关键字 20 void OutPut(BTNode *t,int k){ if(t==null) return; if(t->rchild!=null){ OutPut(t->rchild,k); } if(t->data>=k){ printf("%d\n" 阅读全文
posted @ 2019-12-25 10:53 ZzUuOo666 阅读(361) 评论(0) 推荐(0) 编辑
摘要: //线索二叉树 //中序遍历线索二叉树 19 //tag为0 指示有孩子 tag为1说明有前驱或后继 BTNode *firstNode(BTNode *t){ while(t->ltag==0){ t=t->lchild; } return t; } BTNode* NextNode(BTNode 阅读全文
posted @ 2019-12-25 10:51 ZzUuOo666 阅读(309) 评论(0) 推荐(0) 编辑
摘要: //先序遍历下的第k个结点 int preorder(BTNode *t,int k,int n){ int result; if(t==null) return 0; if(n==k) return t->data; result=preorder(t->lchild,k,n+1); if(res 阅读全文
posted @ 2019-12-25 10:50 ZzUuOo666 阅读(447) 评论(0) 推荐(0) 编辑