2016年6月1日

摘要: 阅读全文

posted @ 2016-06-01 11:51 洪爵士 阅读(455) 评论(0) 推荐(0) 编辑

摘要: LinkList.h文件 LinkList.c文件 test.c文件,测试单链表 阅读全文

posted @ 2016-06-01 11:45 洪爵士 阅读(228) 评论(0) 推荐(0) 编辑

摘要: LinkList.h文件 LinkList.c文件 test.c文件 为了测试这个单链表 阅读全文

posted @ 2016-06-01 11:40 洪爵士 阅读(105) 评论(0) 推荐(0) 编辑

摘要: 阅读全文

posted @ 2016-06-01 11:19 洪爵士 阅读(130) 评论(0) 推荐(0) 编辑

摘要: #include #include #include //二叉链表示法 typedef struct BiTNode { int data; struct BiTNode *lchild,*rchild; }BiTNode; void inOrder(BiTNode *root)//中序遍历(先遍历左子树然后遍历根最后遍历右子树) { if(root==NULL) { retu... 阅读全文

posted @ 2016-06-01 11:13 洪爵士 阅读(2292) 评论(0) 推荐(0) 编辑

摘要: #include typedef struct BiTNode { char data; struct BiTNode* rchild; struct BiTNode* lchild; }BiTNode; //计算树的深度 int TreeDepth(BiTNode *root) { int right=0; int left=0; int deep=0; if(root==NU... 阅读全文

posted @ 2016-06-01 11:12 洪爵士 阅读(6292) 评论(0) 推荐(0) 编辑

摘要: 冒泡排序:相邻元素比较,满足条件就交换元素 1 #include <stdio.h> 2 void PrintArray(int *arr,int len) 3 { 4 int i=0; 5 for(i=0;i<len;i++) 6 { 7 printf("%d ",arr[i]); 8 } 9 } 阅读全文

posted @ 2016-06-01 11:07 洪爵士 阅读(146) 评论(0) 推荐(0) 编辑

摘要: 阅读全文

posted @ 2016-06-01 11:04 洪爵士 阅读(109) 评论(0) 推荐(0) 编辑

2016年5月31日

摘要: #include #include #include /* 找到⼀个未知长度单链表的倒数第K个节点。 提示: head—>1—>2—>3—>4—>5—>6—>7—>8—>9—>10—>NULL 其中倒数第0个节点是NULL,倒数第1个节点是10,倒数第10个节点是1. */ //第一种方法:先遍历一遍,然后计算链表的长度 // 然后使用指针跳动 //第二中方法:使用两个... 阅读全文

posted @ 2016-05-31 16:06 洪爵士 阅读(357) 评论(0) 推荐(0) 编辑

摘要: #include #include //单链表的逆序使用三个辅助指针 typedef struct Node { int data; struct Node *next; }Node; //从尾部添加节点 void AppendtoEnd(Node *head, int data) { Node *new_node=NULL; Node *temp=NULL; new_node=... 阅读全文

posted @ 2016-05-31 15:52 洪爵士 阅读(181) 评论(0) 推荐(0) 编辑