- 博客(7)
- 收藏
- 关注
原创 2117数据结构实验之链表二:逆序建立链表
#include <stdio.h>#include <stdlib.h>struct node{ int data; struct node *next;}*p, *q, *tail;int main(){ int n; scanf("%d", &n); tail = (struct node*)malloc(...
2018-10-19 20:56:05 192
原创 2116数据结构实验之链表一:顺序建立链表
#include <stdio.h>#include <stdlib.h>struct node{ int data; struct node *next;}*p, *q, *head;int main(){ int n; scanf("%d", &n); head = (struct node*)malloc(...
2018-10-19 20:48:02 122
原创 3330顺序表应用6:有序顺序表查询
运用二分查找,节省时间,“有序”顺序表,无需排序,直接用二分查找#include <stdio.h>#include <stdlib.h>int a[1000009];int n;void find(int x){ int l=0,r=n-1,m; while(l<=r) { m=(l+r)/2; ...
2018-10-18 15:49:06 179
原创 3329顺序表应用5:有序顺序表归并
#include <stdio.h>#include <stdlib.h>struct node{ int data; struct node *next;}*p, *q1, *q2, *head1, *head2;int main(){ int n, m; struct node *q, *head; scanf("%...
2018-10-18 15:12:41 303
原创 3663顺序表应用4-2:元素位置互换之逆置算法(数据改进)
//数组方法,空间复杂度O(1)#include <stdio.h>#include <stdlib.h>#include <string.h>int a[1000000];int len;void Reverse(int a[],int start,int last){ while(start<last) { ...
2018-10-18 00:12:21 319
原创 3326顺序表应用3:元素位置互换之移位算法
#include <stdio.h>#include <stdlib.h>struct node{ int data; struct node *next;}*p,*head,*q,*tail;int main(){ int n, m, k; scanf("%d", &n); while(n--) { ...
2018-10-17 22:47:48 147
原创 3324顺序表应用1:多余元素删除之移位算法
#include <stdio.h>#include <stdlib.h>struct node{ int a; struct node *next;};int main(){ struct node *p, *q, *head, *tail; int n, i, m, k, b; scanf("%d", &...
2018-10-15 11:56:36 727
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人