![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
文章平均质量分 53
太帅名字无法显示
这个作者很懒,什么都没留下…
展开
-
C++模板(1)
**前言**:为了解决代码复用和数据类型给程序设计带来的困扰引入了模板。**模板1. 分类模板分成函数模板和类模板两大类。2. 函数模板1.声明template<typename 占位符1,typename 占位符2,...,typename 占位符n>template为模板声明关键字;尖括号<>内为模板参数列表占位符1,占位符2,…,占位符n为数据类型举例如下:template<typename T,typename R,typename S&原创 2021-01-26 17:52:46 · 134 阅读 · 0 评论 -
单链表操作实现(代码)
1.头文件datastru.h内容。#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0#define INFEASIBLE -1#define OVERFLOW -2typedef int Status;2.头文件listlink.h内容。//单链表头文件#include "datastru.h"//定义元素类型inttypedef原创 2020-11-03 23:29:55 · 395 阅读 · 1 评论 -
LeetCode打卡第三天(130. 被围绕的区域)------广度优先搜索(BFS)+递归
LeetCode打卡第三天(130. 被围绕的区域)Given a 2D board containing ‘X’ and ‘O’ (the letter O), capture all regions surrounded by ‘X’.A region is captured by flipping all 'O’s into 'X’s in that surrounded region.Example:X X X XX O O XX X O XX O X XAfter runnin原创 2020-07-14 22:38:35 · 126 阅读 · 0 评论 -
LeetCode打卡第二天(120.三角形最短路径)------动态规划问题
LeetCode打卡第二天(120.三角形最短路径)给定一个三角形,找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。相邻的结点 在这里指的是 下标 与 上一层结点下标 相同或者等于 上一层结点下标 + 1 的两个结点。例如,给定三角形:[[2],[3,4],[6,5,7],[4,1,8,3]]自顶向下的最小路径和为 11(即,2 + 3 + 5 + 1 = 11)。说明:如果你可以只使用 O(n) 的额外空间(n 为三角形的总行数)来解决这个问题,那么你的算法会很原创 2020-07-14 22:07:16 · 188 阅读 · 0 评论 -
排序算法-----插入排序(栈实现)
#include<iostream>#include<algorithm>#include<stack>#include<cstdio>using namespace std;int main(){ int a[10]; stack<int> s,r,an; int i,N; printf("请输入元素个数:"); scanf("%d",&N); printf("请输入元素:");原创 2020-07-06 21:02:48 · 231 阅读 · 0 评论 -
求整型数组的最大值、最小值、极大值、极小值
算法分析1.贪心2.switch状态机图解代码#include<cstdio>#include<iostream>#include<algorithm>using namespace std;int main(){ int N; int a[100]; static const int BEGIN = 0; static const int UP = 1; static const int DOWN = 2;原创 2020-07-05 22:12:59 · 930 阅读 · 1 评论