![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++
nuttee
这个作者很懒,什么都没留下…
展开
-
C++注释规范
https://www.cnblogs.com/aspiration2016/p/8433122.html转载 2020-12-18 17:34:23 · 277 阅读 · 1 评论 -
LeetCode Medium Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.Example:Input: "aab"Output:[ ["aa","b"], ["a","a","b&q原创 2019-02-25 10:12:56 · 128 阅读 · 0 评论 -
回溯思想
模板// 探索这个候选方案// 当由它不能构建完整解法时返回false// 当递归地调用LeadToSolution找到完整解法时// 返回trueBoolean: LeadToSolution(Solution: test_solution) // 如果我们已经判断出这个局部解不能得到完整解,返回false If <test_solution 不能解决问题>...原创 2019-02-26 09:15:32 · 233 阅读 · 0 评论 -
LeetCode Medium 3Sum
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not contai...原创 2019-03-05 15:06:22 · 111 阅读 · 0 评论 -
LeetCode Medium Genertate Parenthese
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())", ...原创 2019-02-27 10:21:04 · 133 阅读 · 0 评论 -
LeetCode Medium Swaps To Make Sequences Increasing
We have two integer sequences A and B of the same non-zero length.We are allowed to swap elements A[i] and B[i]. Note that both elements are in the same index position in their respective sequences....原创 2019-03-08 16:25:58 · 150 阅读 · 0 评论 -
LeetCode Medium Longest Palindromeic Substring
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Example...原创 2019-03-04 14:57:05 · 98 阅读 · 0 评论 -
LeetCode Easy To Lower Case
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.Example 1:Input: "Hello"Output: "hello"Example 2:Input: "here"Output: "here"Example ...原创 2019-03-04 15:09:59 · 96 阅读 · 0 评论 -
LeetCode Medium String to Integer(atoi)
Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this...原创 2019-03-04 19:19:39 · 144 阅读 · 0 评论 -
LeetCode Medium Add Two Numbers-II
You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return i...原创 2019-03-07 16:36:07 · 114 阅读 · 0 评论 -
LeetCode Hard Number of Squareful Arrays
title: LeetCode Hard Number of Squareful Arraysdate: 2019-02-26 22:00:00categories:- LeetCodeGiven an array A of non-negative integers, the array is squareful if for every pair of adjacent eleme...原创 2019-02-27 15:08:40 · 196 阅读 · 0 评论 -
排序备忘
#ifndef SORT_H#define SORT_H#ifndef max#define max(a, b) ((a) > (b) ? (a) : (b))#endif#include <memory>#include <string.h>using namespace std;/***********************插入排序****...原创 2018-11-11 11:41:00 · 184 阅读 · 0 评论 -
编译原理:求非终结符的First集合
题目目的:熟练掌握自上而下的语法分析方法,并能用程序实现。 要求:例如. 使用的文法如下:E->TE'E'->+TE'|#T->FT'T'->*FT'|#F->(E)|id编写First函数,实现其求解过程。提示:1, 非终结符为大写字母;或后面带'的大写字母2, 终结符为 小写字母和符号(+、*)(#代表空串)3, 推导符号为->4, 用end结束文法。5,原创 2017-05-06 10:37:21 · 8520 阅读 · 2 评论 -
在main函数里面执行一个返回false的函数过程中遇到的坑
如下:#include<iostream>#include"queue.h"using namespace std;int main() { Queue<int> q(7); q.EnQueue(0); q.disPlay(); q.EnQueue(1); q.disPlay(); q.EnQueue(2); q.disPlay(); q.EnQ原创 2016-10-25 23:22:28 · 753 阅读 · 0 评论 -
通过设置标志位tag判断队空队满的顺序存储的循环队列
首先我们定义一个具有基本操作方法的Queue类,在这个类中我们设置了一个bool型的变量tag,通过判断tag的值来判断队列是否为空、是否为满。具体是:rear==front&amp;&amp;!tag为空,rear==front&amp;&amp;tag为满。 queue.h如下:#ifndef QUEUE_H#define QUEUE_H#include&lt;iostream&gt;using nam原创 2016-11-04 10:52:33 · 8299 阅读 · 1 评论 -
算法:找出所有满足其出现频率大于某个给定阈值的子串
问题: 给定一组字符串的集合(共53个长度相同的字符串),试设计一个算法,找出所有满足其出现频率大于某个给定阈值的子串,其中阈值为输入参数。例如:“taat”这个子串,集合中的53个字符串中有24个字符串包含“taat”这个子串,则其频率计算为24/53. 如果阈值设置为0.5,则该子串由于其频率小于0.5,所以不必输出。反之,如果阈值设置为0.4,则该子串由于其频率24/53大于0.4,故应该被原创 2016-11-04 11:33:49 · 2956 阅读 · 1 评论 -
基于AT89C52和串口通信助手的串口通信
我们要实现的功能是在程序运行的时候通过单片机的串口向串口调试助手发送一个字符串诸如“hello world”,串口通信助手接收到字符串之后显示并由用户反馈回去一个长度为4的字符串并显示到数码管上来看一下效果首先是串口通信电路的配置和借助VSPD、串口通信助手对相关串口的设置通过VSPD创建两个可以相互通信的虚拟串口,如COM1和COM2。点击添加端口按钮后,可以看到左边栏中的虚拟端口处看到你新创建的原创 2016-12-24 17:57:56 · 10516 阅读 · 0 评论 -
编译原理:求产生式的FIRST集合
#pragma once#include #include #include #include #include #include #include using namespace std;/*----------------------------------------全局变量存放终结符和非终结符--------------------------------------原创 2017-06-03 17:50:47 · 2832 阅读 · 0 评论 -
编译原理:求非终结符的FOLLOW集合
#pragma once#include #include #include #include #include #include #include using namespace std;/*----------------------------------------全局变量存放终结符和非终结符--------------------------------------原创 2017-06-03 17:47:32 · 3695 阅读 · 0 评论 -
编译原理:语法分析
目的:熟练掌握自上而下的语法分析方法,并能用程序实现。要求:1. 使用的文法如下: E->TE' E'->+TE'|# T->FT' T'->*FT'|# F->(E)|id2. 对于任意给定的输入串(词法记号流)进行语法分析,递归下降方法和非递归预测分析方法可以任选其一来实现。3. 要有一定的错误处理功能。即对错误能提示,并且能在一定程度上忽略尽量少原创 2017-06-03 18:01:13 · 1144 阅读 · 0 评论 -
博客迁移
博客已经迁移到 https://leerw.github.io,欢迎来访,共同交流进步原创 2017-11-19 18:44:45 · 434 阅读 · 0 评论