数据结构与算法
xiaoyao_yue
这个作者很懒,什么都没留下…
展开
-
快速排序
快速排序 以前就曾经接触过快排,这一次好好整理了一下思路,重写了一遍,记录一下。/*快速排序使用了分治的思想,所以搞明白一趟排序,剩下的以此类推很好理解。首先设置一个参考数,一般都是第一个数,首先从右到左扫描找一个比参考数大的数,再从左到右找一个比参考数小的数,他俩交换,直到参考数左面的数都比他小右面的数都比参考数大,第一趟排序就大功告成了。下面是第一趟排序的例子:5 4 7 2 4原创 2016-11-03 13:06:10 · 426 阅读 · 0 评论 -
蓝桥杯-数列特征
问题描述#include <stdio.h>int main(){ int n,i,max = -10001,min = 10001,sum = 0; scanf("%d",&n); int a[n]; for(i = 0 ; i < n ; i++) { scanf("%d",&a[i]); max = max < a[i原创 2017-02-10 12:45:23 · 1352 阅读 · 1 评论 -
c语言创建单链表
#include <stdio.h>#include <stdlib.h> typedef struct node{ int num; char sex; struct node* next;}Node;Node* init_list(int);int main(int argc, char const *argv[]){ Node* head;原创 2017-05-13 15:53:40 · 704 阅读 · 0 评论 -
顺序栈
代码#include <stdio.h>#include <stdlib.h>#define STACK_INIT_SIZE 100#define STACK_INCREMENT 10#define OK 0#define ERROR -1typedef struct{ int* stackdata; int top; int stacksiz原创 2017-07-12 10:44:09 · 229 阅读 · 0 评论