随笔分类 - 数据结构
摘要:#include<stdio.h> #include<stdlib.h> typedef struct Node { int data; struct Node* next; }Node,*List; void Print(List L) { Node* node; node = L->next;
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef struct Node { char data; struct Node* next; }Node, *List; //分成三段创建链表 Node* CreateList(List L, int length)
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef struct Node { int data; struct Node* next; }Node,*List; void ReverseList(List L) { Node* node1; Node* nod
阅读全文
摘要:1.暴力解法 #include<stdio.h> #include<stdlib.h> void Reverse_p(int arr[], int p, int length) { int index=0; int* A=(int*)malloc(sizeof(int)*length); for(i
阅读全文
摘要:1.暴力解法,不推荐使用 #include<stdio.h> void Swap(int& a, int& b) { int temp; temp=a; a=b; b=temp; } void BubbleSort(int arr[], int length) { int temp; for(int
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef struct Node { int data; struct Node* next; }Node,*List; void CreateList(List L, int k) { Node* node; Node
阅读全文
摘要:#include<stdlib.h> #include<stdio.h> //定义结构体 typedef struct Node { int data; struct Node* link; }Node,*List; //创建链表函数 void CreateList(List L, int k) {
阅读全文
摘要:#include<stdlib.h> #include<stdio.h> //定义结构体 typedef struct Node { int data; struct Node* link; }Node,*List; //创建链表函数 void CreateList(List L, int k) {
阅读全文
摘要:#include<stdio.h> void MergeSort(int* pa,int* pb) { int arr[12]; int a,b,i; a=b=0; for(i=0;i<12&&a<6&&b<6;i++) { if(*(pa+a)<=*(pb+b)) { arr[i]=*(pa+a)
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef struct Node { int data; struct Node* next; }Node, *List; //遍历链表函数 void outputValue(List L) { Node* node=L
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef struct Node{ int data; struct Node* next; }Node; void changeValue(Node& node)//引用 { node.data++; } void p
阅读全文
摘要:Position BinarySearch(List L, ElementType X){ Position Left,Right,Mid; Left=1; Right=L->Last; while(Left<=Right){ Mid=(Left+Right)/2; if(X==L->Data[Mi
阅读全文

浙公网安备 33010602011771号