随笔分类 -  C语言实现基本的数据结构与算法

重视基本功,c语言实现基本的数据结构与算法
摘要:1 #include<stdio.h> 2 3 #define MAXN 100 4 //A[p,q] A[q+1,r]是两个有序数组,想办法把他们结合成一个有序数组 5 void merge(int A[],int p,int q,int r){ 6 int n=0; 7 int i=p; 8 int j=q+1; 9 int tmp[MAXN]; 10 while(i<=q&&j<=r){ 1 阅读全文
posted @ 2019-08-29 08:48 汪昕 阅读(1203) 评论(0) 推荐(2)
摘要:data.in文件 阅读全文
posted @ 2017-11-24 10:51 汪昕 阅读(1707) 评论(0) 推荐(0)
摘要:#include #include #include // TODO: 在此处引用程序需要的其他头文件 struct String{ char* ch; int length; }; bool Assign_String(String* str, char* chars); bool Destroy_String(String* str); bool Clear_... 阅读全文
posted @ 2017-10-28 11:36 汪昕 阅读(1301) 评论(0) 推荐(0)
摘要:#include #include #include #define MaxQueueSize 100 // TODO: 在此处引用程序需要的其他头文件 struct Node{ int data; Node* next; }; struct Queue{ Node* front; Node* rear; }; //初始化队列 bool Init_Qu... 阅读全文
posted @ 2017-10-28 09:00 汪昕 阅读(1162) 评论(0) 推荐(0)
摘要:#include #include #include #define MaxQueueSize 100 // TODO: 在此处引用程序需要的其他头文件 struct Queue { int* base; int front;//队头指针 int rear;//队尾指针 }; //初始化队列 bool Init_Queue(Queue* q){ q->... 阅读全文
posted @ 2017-10-27 21:34 汪昕 阅读(582) 评论(0) 推荐(0)
摘要:#include #include #include #define StackSize 5 #define IncrementSize 5 // TODO: 在此处引用程序需要的其他头文件 struct Stack { int *base; int *top; int stacksize; }; //初始化栈 bool Init_Stack(Stack* s... 阅读全文
posted @ 2017-10-27 20:20 汪昕 阅读(2669) 评论(0) 推荐(0)
摘要:#include "stdafx.h" #include //创建一个节点,data为value,指向NULL Node* Create(int value){ Node* head = (Node*)malloc(sizeof(Node)); head->data = value; head->next = NULL; return head; } //销毁链... 阅读全文
posted @ 2017-10-27 11:26 汪昕 阅读(14678) 评论(0) 推荐(0)
摘要:#include #include #include #define LIST_INIT_SIZE 100 #define LISTINCREMENT 10 // TODO: 在此处引用程序需要的其他头文件 // typedef struct{ int *elem; int length;//当前长度 int listsize;//当前分配的存储容量 }SqList; //新建线性... 阅读全文
posted @ 2017-10-26 21:15 汪昕 阅读(5105) 评论(0) 推荐(0)