- 博客(63)
- 资源 (9)
- 收藏
- 关注
原创 如何提取matlab产生的.fig图像中的数据
相信很多理工科研究生们在学术研究时,通常会画ROC曲线图来表示自己实验结果的优越。但是在paper时,需要和其他方法进行对比,因此,你需要复现其他人的方法,然后画出ROC曲线,再将自己的ROC曲线与其他的画到同一个图中进行对比。好了,上面全是废话,下面来重点:通常,如果你保存着x,y数据那就不用看了,你可以直接画,如果你手里只有生成的.fig图,那么怎么合并呢,方法有下面两种情况:1、每张fig图...
2018-03-25 17:14:42
16490
1
原创 单词翻转
牛客最近来了一个新员工Fish,每天早晨总是会拿着一本英文杂志,写些句子在本子上。同事Cat对Fish写的内容颇感兴趣,有一天他向Fish借来翻看,但却读不懂它的意思。例如,“student. a am I”。后来才意识到,这家伙原来把句子单词的顺序翻转了,正确的句子应该是“I am a student.”。Cat对一一的翻转这些单词顺序可不在行,你能帮助他么?
2017-10-08 15:47:47
347
原创 二维数组的查找
在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。
2017-09-29 18:38:07
178
原创 查找B字符串中出现的字符是否在A中全部出现
判断较短的字符串中出现的字符是否在较长字符中全部出现,若有重复的,长字符串中此字符的个数必须大于或者等于短字符串中重复的个数
2017-09-19 16:01:59
1517
原创 数组全排列问题
vectora(3);vectorvisit(3);void print(vectora)//输出一次排列{ for (int i = 0; i < a.size(); i++) { cout << a[i]; } cout << endl;}void DFS(int index,int n){ if (index >= n) { print(a); retu
2017-09-15 13:33:18
312
原创 图的深度优先遍历
void DFT(vector>G, int i, int n,vector&visit)//标志数组必须采用引用传递{ visit[i] = true; cout << i + 1; for (int j = 0; j < n; j++) { if (G[i][j] == 1 && !visit[j]) { DFT(G, j, n, visit); }
2017-09-15 12:05:50
213
原创 图的广度优先
void BFT(vector>G, int n)//G是图,n是点的个数{ vectorvisit(n); dequeQ; for (int i = 0; i < n; i++) { if (!visit[i]) { visit[i] = true; cout << i+1; Q.push_back(i); while (!Q.empty()) {
2017-09-15 11:27:56
297
原创 8.20 NP问题
在一个无向图G=(V,E)中,我们称D⊆V为一个占优集,是指每个V∈V都属于D或与D中一个节点为邻。在占优集问题中,输入为一个图和预算b,目标是求图的一个规模不超过b的控制集——如果该集存在。证明该问题是NP-完全的。解答: 可以将顶点覆盖问题规约到支配集问题。若要在图G(V,E)中求不得大于b的一个顶点覆盖,可以先对图G做一个预处理;对每条边(u,v)∈E,添加一个辅助顶点w,及两条边(u,w)
2017-07-05 21:32:48
539
原创 1006.单词变换
对于两个只含有小写英文字母(’a’-‘z’)的单词word1和word2,你可以对word1进行以下3种操作:(编辑距离)1) 插入一个字母;2) 删除一个字母;3) 替换一个字母.请计算将word1变换成word2的最少操作数.
2017-06-27 20:11:03
384
原创 1005.最大和
从数列A[0], A[1], A[2], ..., A[N-1]中选若干个数,要求相邻的数不能都选,也就是说如果选了A[i], 就不能选A[i-1]和A[i+1]. 求能选出的最大和.
2017-06-27 20:09:39
214
原创 1004.无环图
在图论中,如果一个有向图从任意顶点出发无法经过若干条边回到该点,则这个图是一个有向无环图(Directed Acyclic Graph,DAG). 对于一个n个节点的有向图(节点编号从0到n-1),请判断其是否为有向无环图.
2017-06-27 20:08:20
323
原创 1001.会议安排
N个会议要同时举行,参会人数分别为A[0], A[1], ..., A[N-1]. 现有M个会议室,会议室可容纳人数分别为B[0], B[1], ..., B[M-1]. 当A[i]<=B[j]时,可以把会议i安排在会议室j,每间会议室最多安排一个会议,每个会议最多只能安排一个会议室. 求最多安排多少个会议.1 <= N, M <= 100000, 每个会议的参会人数和每间会议室的容纳人数均在1和1000之间.
2017-06-27 20:01:45
422
原创 1000.函数求值
F(0, n) = n,对于所有的正整数n..F(k, n) = F(k – 1, 1) + F(k – 1, 2) + … + F(k – 1, n),对于所有的正整数k和n.
2017-06-27 19:43:36
368
原创 143. Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.
2017-06-25 22:01:00
180
原创 92. Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass.
2017-06-16 15:42:19
137
原创 86. Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
2017-06-10 18:22:15
141
原创 86. Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
2017-06-02 15:07:35
183
原创 59. Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
2017-06-02 14:58:51
218
原创 54. Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
2017-05-27 10:53:30
179
原创 83. Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.
2017-05-18 13:29:50
257
原创 43. Multiply Strings
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.
2017-05-18 13:20:08
210
原创 34. Search for a Range
Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.
2017-05-13 12:57:39
198
原创 8. String to Integer (atoi)
Implement atoi to convert a string to an integer.
2017-05-13 12:53:14
152
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人