自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 十种排序算法总结——直接插入排序+折半插入排序+希尔排序+冒泡排序+快速排序+简单选择排序+堆排序(大根堆+小根堆)+归并排序+基数排序+桶排序+数组散列、集合模拟桶排序

十种常见算法总结+代码

2019-11-07 17:55:41 517

原创 Dijkstra算法及其邻接矩阵和邻接表的实现+邻接表和图论实现单源最短路径

Dijkstra算法+邻接矩阵+邻接表+图论实现单源最短路径问题求解这里的是有向图,即两点路径不可逆,无向图类似,不再赘诉。这里一共介绍四块内容,打字太累,直接用笔记本拍摄的图片,笔记本上写的很细了,外附代码和测试用例。这几个主要的区别是:1.邻接矩阵:二维数组,n大的时候没法用,太耗空间,而且每次更新路径都要从1~n,耗时。2.邻接表:一维数组,省空间,next下一个邻接节点,无...

2019-11-06 22:23:55 1796

原创 AVL树构造代码(C++)

AVL树的构造和遍历就是很基础的AVL树构造问题,值得注意的就是如和判断是否要进行平衡,以及进行怎么样的平衡。此处我用flag标记,标记为2或-2的结点需要平衡,flag即是左右子树高度差。如某p结点p->flag=2,即左子树高度高出右子树2,再判断p->lchild->flag值,为1的话就是LL(因为p->child的左子树也高1),为-1就是LR(p->l...

2019-11-06 15:23:27 431

原创 单峰+半平面交1038: [ZJOI2008]瞭望塔

List item在这里插入代码片

2019-05-30 00:38:55 212

原创 二叉树遍历——已知前序和中序遍历后序,数组方法

1009: 二叉树遍历时间限制: 1 Sec 内存限制: 2 MB题目描述给出一棵二叉树的前序遍历序列和中序遍历序列,根据前序和中序序列还原二叉树之后,得到二叉树的后序遍历序列输入两个字符串,其长度n均小于等于26。第一行为前序遍历,第二行为中序遍历。二叉树中的结点名称以大写字母表示:A,B,C…最多26个结点。输出输入样例可能有多组,对于每组测试样例,输出一行,...

2019-05-29 15:03:03 1045

原创 HDU1242 Rescue (BFS + 优先队列)

Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison. Angel’s friends w...

2018-08-17 16:54:43 156

原创 POJ 2312 Battle City 【BFS + 优先队列】

Many of us had played the game “Battle city” in our childhood, and some people (like me) even often play it on computer now. What we are discussing is a simple edition of this game. Given a...

2018-08-17 14:21:30 208

原创 POJ1470 (Closest Common Ancestors)

Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common ancestor of u and v in the tree. The closest common ...

2018-08-16 17:28:48 268

原创 POJ1330 Nearest Common Ancestors (树类型水题)

A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with an integer from {1, 2,…,16}. Node 8 i...

2018-08-16 16:15:38 214

原创 HDU-2087 剪花布条

一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。 ...

2018-08-14 10:53:10 206

原创 POJ 2406 Power Strings

Given two strings a and b we define a*b to be their concatenation. For example, if a = “abc” and b = “def” then a*b = “abcdef”. If we think of concatenation as multiplication, exponentiation by a n...

2018-08-11 16:58:55 109

原创 HDU1068(二分图基础题 匈牙利算法 Girls and Boys )

题目等材料来源于网络 In the second year of the university somebody started a study on the romantic relations between the students. The relation “romantically involved” is defined between one girl and one ...

2018-08-10 15:38:13 528

原创 POJ-1308 Is It A Tree?

题目源于网络 A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following proper...

2018-08-07 16:35:13 168

原创 POJ-2074

An architect is very proud of his new home and wants to be sure it can be seen by people passing by his property line along the street. The property contains various trees, shrubs, hedges, and othe...

2018-08-06 14:58:59 314

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除