![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
无休居士
莫欺中年穷
展开
-
循环链表
#include <stdio.h>#include <stdlib.h>typedef struct Clinklist//struct关键字,定义的一个“结构类型” Clinjlist是结构名{ int data; //数据域 struct Clinklist *next;//指针域}node;//定义结构变量node,对成员的访问可以用例如node.datavoid d原创 2015-10-16 21:59:16 · 337 阅读 · 0 评论 -
排序算法之插入排序(Java版)
思路: 这里 3 插入到 6,8 前面和上几步操作一样,当,3与2做判断后,3比2大 ,所以不和2互换位置,即3不插到2前面 代码:public class FunctionTest { public static void main(String[] args) { int[] array = {3,4,7,1,2,5,9,8,6}; ...原创 2018-09-04 23:35:17 · 148 阅读 · 0 评论 -
队列的链式表示和实现
#include <stdio.h>#include <stdlib.h>#define ElemType inttypedef struct Qnode{ElemType data;struct Qnode *next;}Qnodetype;typedef struct{Qnodetype *front;Qnodetype *rear;}Lqueue;void Lappen原创 2015-10-16 22:19:23 · 491 阅读 · 0 评论 -
学生-简单链表
#include <stdio.h>#include <stdlib.h>#include <malloc.h>struct node{ int num; char str[20]; struct node *next;};int main(){ struct node *creat(); struct node *insert(); s原创 2015-10-16 22:00:34 · 314 阅读 · 0 评论 -
约瑟夫问题
#include <stdio.h>#include <stdlib.h>typedef struct node{ int data; struct node *next;}node;node *create(int n){ node *p=NULL,*head; head=(node*)malloc(sizeof(struct node)); p原创 2015-10-16 21:52:35 · 357 阅读 · 0 评论 -
单链表操作
#include <stdio.h>#include <stdlib.h>#include <math.h>typedef int ElemType;typedef struct LNode{ ElemType data; struct LNode *next;}LNode;LNode *L;LNode *creat_L();void out_L(LNode *L);原创 2015-10-16 22:23:17 · 369 阅读 · 0 评论 -
顺序表的操作
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20typedef int Elemttype;typedef struct{ Elemttype a[MAXSIZE];//一维数组子域 int length;//表长度子域}SqList;//顺序储存的结构类型SqList a,b,c;void creat_l原创 2015-10-16 22:02:35 · 379 阅读 · 0 评论 -
先序遍历的非递归算法
#include <iostream>using namespace std;#define OK 1#define ERROR 0typedef int Status;typedef int sElemType;typedef struct BiTNode{ sElemType data; struct BiTNode *lchild,*rchild;}BiTNode,原创 2015-10-16 22:01:18 · 1061 阅读 · 0 评论 -
栈的链式实现
#include <stdio.h>#include <stdlib.h>#include <malloc.h>typedef int Elemtype;typedef struct StackNode{Elemtype data;struct StackNode *next;}StackNode;typedef struct{ struct StackNode *top;//栈原创 2015-10-16 21:51:39 · 380 阅读 · 0 评论 -
哈弗曼树
#include"stdio.h"#define LEN sizeof(struct HTnode)int i,l,n,w=0,c,start,a1,a2,f;struct HTnode {unsigned int weight; unsigned int parent,lchild,rchild; }*p,*HT;typedef char **Huffmancod转载 2015-10-16 22:15:37 · 501 阅读 · 0 评论 -
栈的顺序表示和实现
#include <stdio.h>#include <stdlib.h>#define MAX 20typedef int Elemtype;//必须加上;//定义顺序栈的储存结构typedef struct{ Elemtype stack[MAX]; int top;}SqStack;//初始化void InitStack(SqStack *p){ i原创 2015-10-16 21:49:30 · 378 阅读 · 0 评论 -
KMP-看毛片算法
#include <stdio.h>#include <stdlib.h>void insert(int *arr, int a, int n){ /*0到n-1都已排好序*/ int i; int key = a; for(i=0; i<n; i++){ if(key < arr[i]){ int j; for(j=n-1; j>=i; j--){ arr[j+1]原创 2015-10-16 22:26:20 · 5734 阅读 · 0 评论 -
建立图的邻接表储存并实现深度优先和广度优先遍历
#include <stdio.h>#include <stdlib.h>#define MAX 20typedef int Vextype;typedef struct Vnode{Vextype data;struct Vnode *next;}Vnode;//顶点的结点结构typedef Vnode Lgraph[MAX];//一维数组类型标识符//定义队列typedef原创 2015-10-16 22:14:18 · 9215 阅读 · 0 评论 -
我们学习算法与数据结构有什么用?
似乎当提到为什么学习算法的时候?大多数的同学会觉得是为了应付大企业的IT面试?进而得到一个好的工作,站到一个更高的平台?但是这里我想更深入的告诉大家算法在计算机这个行业中的重要性,可以说算法无处不在。最常见的搜索引擎、智能机器人、推荐购物、扫雷游戏、人脸识别等。只有学好算法才能创造出更有意义的东西,而不是简单的把数据取出来放到一个界面的就行了。学算法很慢、需要从基础一步一步的走、不...原创 2018-09-06 21:47:07 · 5473 阅读 · 0 评论