- 博客(79)
- 资源 (10)
- 收藏
- 关注
原创 LeetCode 3. 无重复字符的最长子串
LeetCode 第三题无重复字符的最长子串难度中等给定一个字符串 s ,请你找出其中不含有重复字符的 最长子串 的长度。示例 1:输入: s = “abcabcbb”输出: 3解释: 因为无重复字符的最长子串是 “abc”,所以其长度为 3。示例 2:输入: s = “bbbbb”输出: 1解释: 因为无重复字符的最长子串是 “b”,所以其长度为 1。示例 3:输入: s = “pwwkew”输出: 3解释: 因为无重复字符的最长子串是 “wke”,所以其长度为 3。请注意
2021-11-30 14:59:57
231
原创 c++17/20 auto推导规则
c++17 auto推导规则规则1: auto 声明的变量是按值初初始化。 如果没有显示的使用引用,也没有指针。那么编译器在推导的时候会忽略const和volatile限定符。const int a =10;auto b = a; // b 为 int, 而不是constauto &c = a;// c 为 const int&const auto e = a; //auto 推导的类型为int, e的类型为 const int(auto)规则2: auto声明变量
2021-11-16 14:19:50
809
原创 LINX IO介绍
I/O设备 现代计算机系统通常配备大量的I/O设备,用于计 算机系统与外部世界(如用户、其它计算机或电 子设备等)进行信息交换或存储 I/O设备又称为外围设备或外部设备,简称外设I/O操作:内存和I/O设备之间的信息传送操作 不仅影响计算机的通用性和可扩充性,也是计算机 系统综合处理能力及性价比的重要因素I/O设备的分类按信息传输方向划分 输入设备:将外界信息输入计算机 例如:键盘,鼠标,扫描仪等 输出设备:将计算结果输出 例如:
2021-11-14 17:56:55
2246
翻译 namespace嵌套命名空间的简化语法
有时候打开一个嵌套命名空间可能只为了向前生命某个类。或者函数,但是却要编写冗余的嵌套代码,加入一些无畏的缩进,c++17推出一种更加简洁的方式namespace A::B::C { int foo() { return ... }}等同于一以下代码namespace A { namespace B{ namespace C { } }}...
2021-11-13 22:33:00
554
原创 如何在linux中打印程序堆栈信息
如何在linux中打印程序堆栈信息 有时候在写完代码之后需要自己手动测试功能,在linux环境中往往需要gdb调试打断点查看堆栈。往往公司的服务器一般是多人同时使用的。往往性能不是太强。gdb调试的时候载入的时候Reading symbols from的时候往往会卡那么一会儿虽然时间不长,但是很烦。我在这里写了简单实用打印堆栈的工具类。算是减少一点工作量。 偶尔会遇到程序崩溃的情况,但是在一些线上部署环境的时候通常调试环境很复杂,通常由于特殊情况下core文件无法产生,或者无法拿到。这个类也.
2021-11-11 11:54:15
7336
原创 Linux centos安装nerdtree 一键部署环境
linux 上面安装nerdtree,这几年来换过好几次机器。每次都要部署开发环境很麻烦。索性把写了一个nerdtree的自动部署。记录一下以后自己警察用。以下是centos下的shell 脚本大家可以创建一个.sh文件。然后把一下代码拷贝进去。然后执行。#网址如果失效了。可以评论一下。我来即时更换网址#http://www.vim.org/scripts/download_script.php?src_id=17123 为nerdtree的下载地址 -O指定名称wget http://www.
2021-11-09 16:28:29
1090
原创 一文搞懂linux时间片,硬件时钟,软件时钟,实时时钟,时间中断,墙上时间
时间片: 时间片是一个数值,它表明程序在被抢占前所持续运行的时间。相对时间绝对时间区别: 如果某个时间在5s后呗调度执行,那么系统所需要的不是绝对时间,而是相对时间(比如,相对现在5s后);相反,如果被要求管理当前日期和当前时间,则内核不但要计算流逝的时间而且还要计算绝对时间.实时时钟(又名硬件时钟,时钟硬件,系统定时器):(理解为一个电子设备) A real-time clock (RTC) is an electronic device (most often in the for
2021-11-09 12:27:50
7277
原创 精确测试执行一个函数所需时间
精确测试执行一个函数所需时间c++11 新增了 std::chrono library 库包含了三种时钟system_clock 系统时钟steady_clock 稳定时钟 (单调时钟) 绝不会调整的high_resolution_clock 高分辨率时钟三种结构体的主要参数 //部分源码 /** * @brief System clock. * * Time returned represents wall time from the system
2021-11-04 15:03:11
355
原创 LeetCode Merge Two Sorted Lists C++
#include <iostream>#include <vector>#include<algorithm>#include <queue>using namespace std;/************************************************************************//* Problem: Merge two
2017-08-10 13:18:00
387
原创 LeetCode Remove Nth Node From End of List C++
#include <iostream>#include <vector>#include<algorithm>#include <queue>using namespace std;/************************************************************************//* Problem: Given a li
2017-08-09 13:29:07
443
原创 LeetCode Add Two Numbers C++
#include <iostream>#include <vector>#include<algorithm>#include <queue>using namespace std;/************************************************************************//* Problem: You ar
2017-08-07 17:45:26
404
原创 LeetCode 4Sum C++
#include <iostream>#include <vector>#include<algorithm>#include <queue>using namespace std;/************************************************************************//*Problem:Given an array S of
2017-08-05 23:46:02
612
原创 LeetCode Letter Combinations of a Phone Number C++
#include <iostream>#include <vector>#include<algorithm>#include <queue>using namespace std;/************************************************************************//*Problem: Given a digit s
2017-08-05 13:54:24
739
原创 LeetCode 3Sum C++
#include <iostream>#include <vector>#include<algorithm>#include <queue>using namespace std;/************************************************************************//*Problem: Given an array
2017-08-04 00:08:32
556
原创 LeetCode 3Sum Closest C++
#include <iostream>#include <vector>#include<algorithm>#include <queue>using namespace std;/************************************************************************//* Problem: Given
2017-08-02 20:42:27
505
原创 LeetCode Container With Most Water C++
#include <iostream>#include <vector>#include<algorithm>#include <queue>using namespace std;/************************************************************************//* Problem: Given
2017-08-02 15:42:54
287
原创 LeetCode Longest Substring Without Repeating Characters C++
#include <iostream>#include<string>#include <map>using namespace std;/* Problom: Given a string, find the length of the longest substring without repeating characters. Example
2017-08-02 08:51:34
331
原创 LeetCode Reverse Integer C++
class Solution {public: int reverse(int x) {#if 0 //可以用这部分简洁的、 int ans = 0, lo = INT_MIN / 10, hi = INT_MAX / 10; while (x) { if (ans < lo || ans > hi)
2017-08-01 15:51:27
362
原创 LeetCode Two sum c++
问题:https://leetcode.com/problems/two-sum/description/#include <iostream>#include <vector>#include<algorithm>using namespace std;/*********************************************************************
2017-08-01 12:26:13
395
原创 求每日零点秒数
求每日零点秒数const int GameConfiger::dayzerotime(void){ time_t timep; struct tm *p; time(&timep); //printf("time() : %d \n", timep); p = localtime(&timep); p->tm_hour = 0; p->tm_
2017-04-24 11:32:16
423
原创 学习《POSIX多线程程序设计》笔记一(分离线程)
//以下程序在linux 系统亲测通过//gcc detachstate_pthread.c -o detachstate_pthread -lpthread#include <stdlib.h>#include <stdio.h>#include <pthread.h>void thread_routine (void){ int i =0; for(i=0;i<10
2017-02-15 11:55:21
462
原创 学习《POSIX多线程程序设计》笔记一
/* * lifecycle.c * * Demonstrate the "life cycle" of a typical thread. A thread is * created, and then joined. */#include <pthread.h>#include <stdio.h>#include <stdlib.h>//#include "errors.h"/
2017-02-14 15:22:11
502
原创 NPC 击退.拉近.简单方法
//create by crazys_popcorn@126.com#include "iostream"#include "stdlib.h"#include "math.h"using namespace std;//坐标点struct xFpos{ float x; float y; xFpos(float _x, float _y) :x(_x),
2017-01-16 14:55:57
872
原创 先序,中序,后序,求叶子结点数,深度,拷贝,几种二叉树的常见递归使用方法
#include "stdio.h"#include "stdlib.h"#include "string.h"typedef struct Node{ int data; struct Node *lchild, *rchild;}BiNode , *BiTree;//中序void inOrder(BiNode *root){ if (root!=NULL)
2016-12-26 21:28:36
614
原创 二叉树的度为2的节点和叶子节点的关系
不知道度为2的节点,和叶子节点的概念,可以看点击【二叉树简介】等下。我要发挥我发画图神功了. (手动捂脸).jpg 我觉得我画的这个图不错了。将就这看把。。 总结公式 等于 用 x 代表 度为2的结点 y代表叶子结点 总结: x+1= y;
2016-12-23 20:29:37
9475
原创 二叉树简单介绍
参考大话数据结构.//后续文章会写入完整的的代码二叉树的度二叉树结点子树个数最多的那个结点的度为二叉树的度如图: 二叉树的深度假设根结点的层次为1,那么L层的结点的子树根节点的层次为L+1;树中的叶子结点所在的最大层级;节点的关系 注意看箭头-, B对D说,我是的双亲,也就是B是D的双亲结点 B是A的孩子结点, B,和C都是A的孩子,所以B 和C 是兄弟结点二叉树3种遍历方法1
2016-12-23 19:20:21
1401
原创 通用简单版-顺序表
seqlist.h#pragma once//给用户的头文件//顺序表//顺序表和链表的区别是 :顺序表是申请一段连续的内存//顺序表可以利用类似于数组的形式访问,即通过下标访问。当然定义的变量类型必须是指针类型的,很方便,当然也可以通过像链表一样的访问。//单链表嘛,只是将空间分散开了,这样的优点就是动态申请,需要多少就申请多少,一般一次申请一个空间结点,即N=1。//当然顺不表也可以实
2016-12-20 14:55:17
472
原创 通用简单版循环链表
circle.h#pragma once//给用户的头文件typedef void CircleList;typedef struct _tag_CircleListNode{ struct _tag_CircleListNode *next;}CircleListNode;//创建CircleList *CircleList_Create();//销毁void CircleList
2016-12-19 17:39:06
472
原创 通用简单版 单链表
main.c 文件#include "stdlib.h"#include "LinkList.h"#include "stdio.h"typedef struct Teacher{ LinkListNode node; int age;}Teacher;void main(){ Teacher t1, t2, t3; t1.age = 10; t2.
2016-11-26 21:31:42
405
原创 原码、补码其实很简单
算术运算中的数值都带有符号以表示正负 计算机中用0表示正,用1表示负 原来带有“+”、 “-”号的数据表示为真值 真值:x= +1011 y=-1011 机器数: x= 01011 y=11011原码 二进制真值X的原码编码方法(n位) 对最高位对符号部分进行编码 用0表示’+’ ,用1表示’-’ 剩下的(n-1)位对数字部分进行编码 编码与X的数
2016-11-07 23:06:03
1978
原创 真值、机器数
算术运算中的数值都带有符号以表示正负 计算机中用0表示正,用1表示负 原来带有“+”、 “-”号的数据表示为真值 真值:x= +1011 y=-1011 机器数: x= 01011 y=11011
2016-11-07 20:21:07
1042
原创 十进制与二进制相互转换(包括带小数点.各类进制转换公式)
首先从进位制,来讨论 十进制 0-1-2-3-4-5-6-7-8-9例如: 365.32(十进制) 小数点左等于 3*10^2+6*10^1+5*10^0 右边等于 3*10^-1 + 2*10^-2 综合结果= 3*10^2+6*10^1+5*10^0+3*10^-1 + 2*10^-2 10在十进制中叫做10进制的基数 在十进制中相邻的差距是10倍,(不
2016-11-07 15:52:47
16414
原创 linux 下 时间字符串怎么解析成秒
//解析类似于 "20160925 12:00:00" 的字符串char tempchar[256];bzero(tempchar,sizeof(tempchar));xml.getNodePropStr(node,"starTime",tempchar,sizeof(tempchar));//这句话随便怎么写,反正就是要把 文本里面的时间读取到 //时间格式为 "20160925
2016-09-23 10:43:10
1388
原创 bitwise constness与logical constness【EC++笔记】
当成员函数为const时 constness(常量性)bitwise constness:不更换对象内任何一个字节,编译器判断成员变量没有赋值动作即可。不足:class test{public: char& operator[](size_t index) const { return mPointer[index]; } test
2015-04-07 11:06:19
1807
原创 C++ 隐式转换。
在C++中;有两种方法可以用来定义从类型From到类型Tode隐式转换。第一种。我们可以在类To中定义一个只含一个参数的构造函数(没有其他参数的缺省参数)class To{public:To(const From&);// or是 To(From)//……};或者我们在Form里面定义个;class From{public:operator
2015-01-18 20:21:33
583
原创 C语言数字转化为字符串
#include int len(char *str){ int i = 0; while (str[i]) { i++; } return i;}void reverse(char *str) //讲字符串首尾颠倒{ int i_len = len(str); char tmp = 0; int i = 0; for (; i < (i_len / 2);
2015-01-14 14:59:10
853
原创 C语言字符串转化为数字
#include int len(const char * str) //得到字符串长度,类似雨strlen函数功能{ int i = 0; while (str[i]) { i++; } return i;}int chartoi(char c){ if ((c>='0')&&(c<='9')) { return c - 0x30; } return
2015-01-14 14:57:30
3249
原创 Unity3D中做血条
public,一张图片;然后使用GUI.DrawTexture函数调用一张图片接着因为是自动update的原因。只要在funtion里面加入判断条件。然后加血,减血。我只说思路,无代码共享;
2014-12-29 15:18:20
789
原创 Unity3D中需要的英文。
MR.C编制这本书 主要对unity3d的所有菜单与参数进行了翻译 并逐个讲解来帮助大家初步的认识Unity3D的每个命令的作用Unity3D下分8个菜单栏(翻译的不一定准)分别是File(文件)Edit(编辑)Assets(资源) GameObject(游戏对象) Component(组件)Terrain(地形) Window(窗口) Help(帮助) Fil
2014-12-27 18:39:06
3895
原创 C语言中输出string方法c_str()用法
今天突然用printf("%s",str);//str 是一个string的时候突然出现乱码,就查了一下为什么。任何时候只有自己敲代码的时候才能发现,,可以用cout语法: const char *c_str();c_str()函数返回一个指向正规C字符串的指针, 内容与本string串相同. 这是为了与c语言兼容,在c语言中没有string类型,故必须通过string类
2014-12-14 18:44:01
7974
Visual Assistant_x破解亲测vs2015可用
2017-02-08
zip文件 VAssistX_10.8.2029.0_Cracked vs2008~vs2013
2015-11-06
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人