<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[Gentle722的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/Gentle722</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; Gentle722]]></copyright><item><title><![CDATA[贪心算法——建雷达站]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/113104585</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/113104585</guid><author>Gentle722</author><pubDate>Mon, 25 Jan 2021 10:30:45 +0800</pubDate><description><![CDATA[/*
	建雷达站
	海岸线上建雷达站 覆盖所有的岛屿 最少的雷达站数目 
	思路：
	倒过来想，在岛屿上看距离d是否与x轴有交点，得到交点的区间
	再得到最少的区间数目 
*/

#include&lt;stdio.h&gt;
#include&lt;algorithm&gt;
#include&lt;cmath&gt;
using namespace std;

const int MAXN = 1000+10;

//覆盖范围与x轴的区间 
struct Interval{
	double left;
]]></description><category></category></item><item><title><![CDATA[贪心算法——看电视]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/113103439</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/113103439</guid><author>Gentle722</author><pubDate>Mon, 25 Jan 2021 09:47:56 +0800</pubDate><description><![CDATA[/*
	看电视问题——区间贪心
	在固定的时间段内尽可能看多的电视节目 
	思路：选择结束时间最早的 
*/

#include&lt;stdio.h&gt;
#include&lt;algorithm&gt;
using namespace std;

const int MAXN = 100 + 10; 


struct program{
	int startTime;
	int endTime;
}; 

program arr[MAXN];

bool Compare(program a,prog]]></description><category></category></item><item><title><![CDATA[贪心算法——疯狂的牛牛]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/113102694</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/113102694</guid><author>Gentle722</author><pubDate>Mon, 25 Jan 2021 09:13:28 +0800</pubDate><description><![CDATA[/*
	疯狂的牛牛
	n个隔间  c头牛
	使每两头牛之间的最小距离最大化 
	思路：
	转化为判定性问题
	判断间距d是否可行；对间距d采取二分策略 
*/ 

#include&lt;stdio.h&gt;
#include&lt;algorithm&gt;
using namespace std;

const int MAXN = 1e5 + 10; 
int arr[MAXN];

bool judge(int n, int m, int distance){
	int current = arr]]></description><category></category></item><item><title><![CDATA[贪心算法——箱子打包问题]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/113097206</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/113097206</guid><author>Gentle722</author><pubDate>Sun, 24 Jan 2021 21:03:12 +0800</pubDate><description><![CDATA[```cpp
/*
	箱子打包
	每个箱子最多放两个物品
	n个物品 求最小的箱子总数 
	思路：
	每次只装一个箱子，选最大和最小的装箱，若溢出则只装最大的物品 
*/
#include&lt;stdio.h&gt;
#include&lt;algorithm&gt;
using namespace std;

const int MAXN = 1e5+10;
int length[MAXN];


int main()
{
	int n,l;
	scanf("%d%d",&amp;n,&amp;l);.]]></description><category></category></item><item><title><![CDATA[贪心算法——烘干衣服问题]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/113096839</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/113096839</guid><author>Gentle722</author><pubDate>Sun, 24 Jan 2021 20:46:18 +0800</pubDate><description><![CDATA[现有n件衣服需要烘干，每件衣服的含水量为ai，如果自然晾干，每分钟含水量减少1；如果使用烘干机烘干，每分钟含水量减少k（直至为0）。只有一台烘干机，每次只能烘干一件衣服，且一次至少使用1分钟。求使所有衣服含水量为0的最少时间是多少。
#include&lt;stdio.h&gt;
#include&lt;cmath&gt;
#include&lt;algorithm&gt;
using namespace std;

const int MAXN = 1e5+10;
int water[MAXN];

//]]></description><category></category></item><item><title><![CDATA[数据结构—括号匹配]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/106276085</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/106276085</guid><author>Gentle722</author><pubDate>Fri, 22 May 2020 11:19:44 +0800</pubDate><description><![CDATA[/*
	栈的应用：括号配对
*/
#include&lt;iostream&gt;
#include&lt;stack&gt;
#include&lt;string.h&gt;
using namespace std;

void MatchBracket(char* S) {
	stack&lt;char&gt; stack;
	int length = strlen(S);
	for (int i = 0; i &lt; length; i++) {
		if (S[i] == '(' || S[i] ]]></description><category></category></item><item><title><![CDATA[数据结构—判断回文数]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/106272193</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/106272193</guid><author>Gentle722</author><pubDate>Fri, 22 May 2020 08:28:16 +0800</pubDate><description><![CDATA[/*
	栈的基本应用：判断回文数
*/
#include&lt;iostream&gt;
#include&lt;cstring&gt;
#include&lt;malloc.h&gt;
#include&lt;stdlib.h&gt;
#define STACK_INIT_SIZE  100 //存储空间初始分配量 
#define STACK_INCREASEMENT  10
using namespace std;
typedef struct {
	char* base;
	char* top;
	]]></description><category></category></item><item><title><![CDATA[数据结构—进制转换]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/106266795</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/106266795</guid><author>Gentle722</author><pubDate>Thu, 21 May 2020 20:34:59 +0800</pubDate><description><![CDATA[/*
	栈的基本应用：进制转换
*/
#include&lt;iostream&gt;
#include&lt;malloc.h&gt;
#include&lt;stdio.h&gt;
#define STACK_INIT_SIZE  100 //存储空间初始分配量 
#define STACK_INCRESEMENT  10
using namespace std;
typedef struct {
	int* base;
	int* top;
	int stacksize;//当前已经分配的存储空间
}]]></description><category></category></item><item><title><![CDATA[数据结构—顺序栈]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/106266314</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/106266314</guid><author>Gentle722</author><pubDate>Thu, 21 May 2020 19:56:35 +0800</pubDate><description><![CDATA[/*
	顺序栈的基本操作
	栈空条件：S.base == S.top
	栈中元素个数：S.top - S.base
*/
#include&lt;iostream&gt;
#include&lt;malloc.h&gt;
#include&lt;stdlib.h&gt;
#define STACK_INIT_SIZE 50 //栈的初始大小
#define STACK_INCREASEMENT 10 //栈的大小的增量
using namespace std;
typedef int ElemType; /]]></description><category></category></item><item><title><![CDATA[链表操作—单链表的销毁与清空]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/106173472</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/106173472</guid><author>Gentle722</author><pubDate>Sun, 17 May 2020 13:44:53 +0800</pubDate><description><![CDATA[/*
	单链表的销毁与清空
	销毁：连同头结点一起释放
	清空：保留头结点；置头结点的指针域为NULL
*/
//销毁链表
void destroyList(Linklist &amp;L) {
	Linklist p;
	p = L;
	while (p)
	{
		L = L-&gt;next;
//		free(p);
		delete(p);
	}
}
//清空链表
void clearList(Linklist &amp;L) {
	Linklist p;
	while (L-&gt;next) ]]></description><category></category></item><item><title><![CDATA[链表操作—头插法尾插法]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/106172974</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/106172974</guid><author>Gentle722</author><pubDate>Sun, 17 May 2020 13:03:21 +0800</pubDate><description><![CDATA[单链表的插入操作，包括头插和尾插，两种的时间复杂度都为O(n)。

/*
	单链表插入操作（头插+尾插）
*/
#include&lt;iostream&gt;
#include&lt;malloc.h&gt;
#include&lt;stdlib.h&gt;
using namespace std;
//定义结点数据类型
typedef int Elemtype;

//结点定义
typedef struct LNode {
	Elemtype data;
	LNode* next;
}LNode, * ]]></description><category></category></item><item><title><![CDATA[链表操作—单链表的倒置]]></title><link>https://blog.youkuaiyun.com/Gentle722/article/details/106172356</link><guid>https://blog.youkuaiyun.com/Gentle722/article/details/106172356</guid><author>Gentle722</author><pubDate>Sun, 17 May 2020 12:09:58 +0800</pubDate><description><![CDATA[链表操作—单链表的倒置
代码：
/*
	单链表的倒置
*/
#include&lt;iostream&gt;
#include&lt;malloc.h&gt;
#include&lt;stdlib.h&gt;
using namespace std;
//定义结点数据类型
typedef int Elemtype;
//结点定义
typedef struct LNode {
	Elemtype data;
	LNode* next;
}LNode, * Linklist;

//创建单链表（头插法）
voi]]></description><category></category></item></channel></rss>