算法
不秃头也能变强
二把刀程序员
展开
-
王道数据结构 循环队列
#include <iostream> #include<stdio.h> #define MaxSize 50 using namespace std; typedef struct { int front, rear; int data[MaxSize]; }sqQueue; void InitQueue(sqQueue &Q) { Q.front = 0; Q.rear = 0; } bool isEmpty(sqQueue &Q) { //判空原创 2021-05-16 00:33:28 · 186 阅读 · 0 评论 -
王道数据结构 顺序队列基本操作
#include <iostream> #include<stdio.h> #define MaxSize 50 using namespace std; typedef struct { int data[MaxSize]; int front, rear; }SqQueue; void InitQueue(SqQueue &Q) { //初始化 Q.front = 0; Q.rear = 0; } bool QueueEmpty(SqQueue &原创 2021-05-15 23:44:42 · 197 阅读 · 0 评论 -
王道数据结构 顺序栈基本操作
#include <iostream> #include<stdio.h> #define MaxSize 50 //定义栈中元素的最大个数 using namespace std; typedef struct { int data[MaxSize]; //存放栈中的元素 int top; //栈顶指针 }SqStack; void InitStack(SqStack &s) { //初始化 s.top = -1; } bool StackEmpty(SqSt原创 2021-05-15 21:17:27 · 205 阅读 · 0 评论 -
数据结构:王道+严蔚敏 顺序表基本操作
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include<stdio.h> #include<time.h> #define MaxSize 10 //定义最大长度 using namespace std; typedef struct { int date[MaxSize];//用静态的“数组存放数据元素” int length; //顺序表的当前长度 }SqList; //顺序表的类型定义 vo原创 2021-04-05 23:16:26 · 594 阅读 · 0 评论 -
快速排序+归并排序c++带注释详解
//快速排序 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include<stdio.h> #include<time.h> using namespace std; void quickSort(int a[], int left, int right) { if (left < right)//判断是否满足排序条件 { int i = left, j = right;//待排序数组的第一原创 2021-04-05 22:37:37 · 149 阅读 · 0 评论 -
棋盘覆盖c++
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include<stdio.h> using namespace std; static int tile = 1;//l型骨牌的编号 static int Board[1024][1024];//棋盘最大为1024*1024 void Chessboard(int tr,int tc,int dr,int dc,int size) { /* tr:当前棋盘左上角的行号原创 2021-01-17 23:55:07 · 540 阅读 · 0 评论