16-数据结构
数据结构学习部分
Y_principal
这个作者很懒,什么都没留下…
展开
-
71-时间复杂度简单理解
时间复杂度即: T(n)=O(f(n))要求时间复杂度,需要分为两个步骤(1)求出执行次数f(n)(2)利用大O表示相关规则对f(n)进行转换。例如for(i=0;i<n;i++){ for(j=0;j<n;j++){printf("执行一次")}}上面的双层for循环一共执行了n*n次。假如上面的程序执行了2(N*N...原创 2020-04-27 12:50:34 · 181 阅读 · 0 评论 -
039-数据结构-五中排序算法--快速排序(2.0 )--(加了详细注释)
#include<stdio.h>#include<malloc.h>#include<stdlib.h>int find_post(int*a, int low, int high){ //【2.1.1】第一个元素给到临时变量 int val = a[low];//a[0] 应该写a[low] //测试是不传递了a ...原创 2019-09-06 09:14:22 · 96 阅读 · 0 评论 -
038-数据结构-五中排序算法--快速排序(1.0 )--(加了详细注释)
#include<stdio.h>#include<malloc.h>#include<stdlib.h>int find_post(int*a, int low, int high){ //【2.1.1】第一个元素给到临时变量 int val = a[low];//a[0] 应该写a[low] //测试是不传递了a ...原创 2019-09-06 08:39:16 · 157 阅读 · 0 评论 -
36-数据结构-循环队列(2.0版本)-加了详细注释
#include<stdio.h>#include<stdlib.h>#include<malloc.h>//【1】定义数据类型typedef struct queue{ //【2】两个参数 front rear int front; int rear; //【3】数组名字 int* pbase;}QUEUE...原创 2019-09-05 10:05:49 · 113 阅读 · 0 评论 -
34-数据结构-循环队列(1.0版本)-加了详细注释
#include <stdio.h>#include <malloc.h>#include <stdlib.h>//【1】队列数据结构typedef struct queue{ int* pbase; // 注意是int * int rear=0; int front=0;}QUEUE;void init(QUEUE...原创 2019-09-04 17:38:24 · 167 阅读 · 0 评论 -
33-数据结构--栈(2)
#include<stdio.h>#include<malloc.h>#include<stdlib.h>//【1】定义数据类型和两个指针typedef struct node{ int data; struct node* pnest;}NODE,*PNODE;typedef struct stack { PNODE p...原创 2019-09-03 21:35:52 · 96 阅读 · 0 评论 -
033-数据结构-栈(1)
【1】#include<stdio.h>#include<malloc.h>#include<stdlib.h>//【1】节点数据类型typedef struct node{ int data; struct node* pnext;}NODE,*PNODE;//【2】栈:两个参数typedef struct stack...原创 2019-09-03 16:35:05 · 109 阅读 · 0 评论 -
31-数据结构-创建链表(3)
#include<stdio.h>#include<malloc.h>#include<stdlib.h>//【1】节点数据类型typedef struct node{ int data; struct node* pnext;}NODE,*PNODE;PNODE creat_list();void travel_list(P...原创 2019-09-03 10:35:32 · 130 阅读 · 0 评论 -
30-数据结构-创建链表(2)
#include<stdio.h>#include<malloc.h>#include<stdlib.h>#include<stdlib.h>//---【1】创建结点数据类型typedef struct node{ int data; struct node* pnext;} NODE, * PNODE;...原创 2019-09-03 09:31:44 · 120 阅读 · 0 评论 -
29-数据结构-链表创建和遍历(1)
学习笔记啦,笔试用的,希望能敲出来#include<stdio.h>#include<malloc.h>#include<stdlib.h>//--【1】----先把每个结点的数据类型写出来-------结构体------------typedefstructNode{intdata;//数据域structNo...原创 2019-09-02 18:09:10 · 149 阅读 · 0 评论 -
032-创建链表和遍历链表(4)
#include<stdio.h>#include<malloc.h>#include<stdlib.h>//【1】数据类型typedef struct node { int data; struct node* pnext;// struct node * 是数据类型 ,所以p->pnext 就是指的p指向的结构体里的指...原创 2019-09-03 11:19:14 · 178 阅读 · 0 评论 -
056-
《题2》void main(){//【1】char一个字节 p8个字节char *p="abcdefgh",*r;【2】q 8个字节long *q;【3】q=(long*)p;q++;r=(char*)q;printf ("%s\n",r);}解释:【1】 这个题在vs2019 无法编译 要改成char ppp[] ...原创 2019-09-11 22:29:09 · 137 阅读 · 0 评论 -
056-二级指针
【1】int a[3][4] 定义一个三行四列的数组【2】a[0][0] 是左上角的第一个元素【3】int i=1;int *p= &i;int **q=&p;int ***w=&q;//w是int ***类型,只能存放 int**类型变量的地址;。、、、、、、、、、、、、、、、、、、、、、、【4】int i = 100;...原创 2019-09-12 11:19:15 · 135 阅读 · 0 评论 -
058-背包问题
【0】看了两天这个东西,还是稀里糊涂,气人的是上面说难度是三颗星,你说气不气→_→【1】所以,直接上结论,说怎么用的,不求理解但求会用dp[i][j]-------表示前i件物品,在容量不超过j的情况下的最大权值space[i]与Value[i]分别代表占的空间与价值,第i件物品是否可以拿,存在两种情况:a.拿走此物品此时的状态即:dp[i-1][j-space[i]]+Value...原创 2019-09-14 16:50:37 · 116 阅读 · 0 评论 -
055- 输入一个链表,按链表从尾到头的顺序返回一个ArrayList(容器和栈动态)
对于一个一直用c语言写链表的人儿来说,看别人答案也是懵逼的好不 (⊙o⊙)…【1】 vector 类似数组(1)可以动态增长,头文件《vector》(2)是一个模板类,实例化一个类,vector <int> ------------数据元素是int的vector<int>类eg:vector <int> V={7,5,4,3,2};...原创 2019-09-11 16:13:48 · 145 阅读 · 0 评论