![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 66
Follow_Inner_Heart
蚂蚁,坚持,喜爱算法,关注大数据和智能家居。
展开
-
C 位域
所谓”位域“是把一个字节中的二进位划分为几 个不同的区域, 并说明每个区域的位数。每个域有一个域名,允许在程序中按域名进行操作。 它实际上是C语言提供的一种数据结构。使用位域的好处是: 1.有些信息在存储时,并不需要占用一个完整的字节, 而只需占几个或一个二进制位。例如在存放一个开关量时,只有0和1 两种状态, 用一位二进位即可。这样节省存储空间,而转载 2014-09-24 14:11:56 · 440 阅读 · 0 评论 -
【leetcode】Pascal's Triangle && Pascal's Triangle II
链接:https://oj.leetcode.com/problems/pascals-triangle/描述:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1],原创 2014-07-28 23:06:30 · 422 阅读 · 0 评论 -
【leetcode】Valid Palindrome
链接:https://oj.leetcode.com/problems/valid-palindrome/描述:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A ma原创 2014-07-28 22:41:02 · 428 阅读 · 0 评论 -
【leetcode】Word Ladder
Word Ladder链接:https://oj.leetcode.com/problems/word-ladder/ 描述:Given two words (start and end), and a dictionary, find the length of shortest transfor原创 2014-07-26 15:21:57 · 587 阅读 · 0 评论 -
【leetcode】Surrounded Regions
链接:https://oj.leetcode.com/problems/surrounded-regions/描述:原创 2014-07-26 14:13:36 · 492 阅读 · 0 评论 -
Sum Root to Leaf Numbers
链接:描述:原创 2014-07-26 14:11:03 · 418 阅读 · 0 评论 -
【leetcode】Longest Consecutive Sequence
链接:https://oj.leetcode.com/problems/longest-consecutive-sequence/描述:原创 2014-07-26 14:06:56 · 495 阅读 · 0 评论 -
【leetcode】Clone Graph
链接:https://oj.leetcode.com/problems/clone-graph/描述:Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serializatio原创 2014-07-25 17:21:41 · 536 阅读 · 0 评论 -
【leetcode】Max Points on a Line
链接:https://oj.leetcode.com/problems/max-points-on-a-line/int maxPoints(vector &points){ int size = points.size(); if(size <= 0 ) return 0; map statics; int result = 0; int max = 0; int inf原创 2014-07-17 23:31:19 · 420 阅读 · 0 评论 -
【leetcode】Populating Next Right Pointers in Each Node
Populating Next Right Pointers in Each Node链接:https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/原创 2014-07-28 23:12:59 · 571 阅读 · 0 评论 -
【leetcode】Triangle
链接:https://oj.leetcode.com/problems/triangle/描述:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For exam原创 2014-07-28 23:00:01 · 405 阅读 · 0 评论 -
【leetcode】Valid Number
连接:https://oj.leetcode.com/problems/valid-number/原创 2014-08-16 09:28:39 · 583 阅读 · 0 评论 -
【leetcode】Permutation Sequence
链接:https://oj.leetcode.com/problems/permutation-sequence/描述:The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,原创 2014-08-16 20:39:33 · 725 阅读 · 0 评论 -
【leetcode】Simplify Path
链接:https://oj.leetcode.com/submissions/detail/9774025/描述:Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/"原创 2014-08-14 21:44:21 · 505 阅读 · 0 评论 -
C++中的引用与指针的区别
C++中的引用与指针的区别 指向不同类型的指针的区别在于指针类型可以知道编译器解释某个特定地址(指针指向的地址)中的内存内容及大小,而void*指针则只表示一个内存地址,编译器不能通过该指针所指向对象的类型和大小,因此想要通过void*指针操作对象必须进行类型转化。 ★ 相同点: 1. 都是地址的概念; 指针指向一转载 2014-08-07 10:16:09 · 531 阅读 · 0 评论 -
static_cast和reinterpret_cast
[cpp] view plaincopy static_cast和reinterpret_cast揭秘 收藏 本文讨论static_castreinterpret_cast reinterpret_cast可以转换任意一个32bit整数,包括所有的指针和整数。可以把任何整数转成指针,也可以把任何指针转成整数,以及把指针转化为任意类型的指针,威力最转载 2014-08-19 10:00:09 · 507 阅读 · 0 评论 -
C++ inline
一、什么叫inline函数? inline(小心,不是online),翻译成“内联”或“内嵌”。意指:当编译器发现某段代码在调用一个内联函数时,它不是去调用该函数,而是将该函数的代码,整段插入到当前位置。这样做的好处是省去了调用的过程,加快程序运行速度。(函数的调用过程,由于有前面所说的参数入栈等操作,所以总要多占用一些时间)。这样做的不好处:由于每当代码调用到内联函数,就需要在调用处直接插入转载 2014-08-06 12:16:45 · 483 阅读 · 0 评论 -
【leetcode】Best Time to Buy and Sell Stock I && II && III
Best Time to Buy and Sell Stock链接原创 2014-07-28 22:59:44 · 645 阅读 · 0 评论 -
×【leetcode】Binary Tree Maximum Path Sum
链接:https://oj.leetcode.com/problems/binary-tree-maximum-path-sum/描述:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:原创 2014-07-28 22:45:52 · 711 阅读 · 0 评论 -
【leetcode】Palindrome Partitioning && Palindrome Partitioning II
Palindrome Partitioning链接:https://oj.leetcode.com/problems/palindrome-partitioning/ 描述:Given a string s, partition s such that every substring of the partitio原创 2014-07-25 17:33:38 · 466 阅读 · 0 评论 -
【leetcode】Gas Station
int start = 0;int total = 0;int tank = 0;for(int i=0; i {tank = tank + gas[i] - cost[i];if( tank {start = i + 1;total += tank;tank = 0;}}return (total + tank)>= 0 ? s原创 2014-07-22 23:33:08 · 448 阅读 · 0 评论 -
【leetcode】Evaluate Reverse Polish Notation
链接:https://oj.leetcode.com/problems/evaluate-reverse-polish-notation/Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand ma原创 2014-07-17 22:21:40 · 367 阅读 · 0 评论 -
C++ new 和 delete 比较
(1)new是c++中的操作符,malloc是c中的一个函数. new是个操作符,和什么"+","-","="...有一样的地位,malloc是个分配内存的函数,供你调用的.正因为如此,new是保留字,不需要头文件支持,malloc需要头文件库函数支持.(2)new不止是分配内存,而且会调用类的构造函数,同理delete会调用类的析构函数.而malloc则只分配内存,不会进转载 2014-07-17 10:46:01 · 389 阅读 · 0 评论 -
notePad++配置C/C++编译运行环境
第一步:安装原创 2014-04-06 10:48:43 · 3226 阅读 · 0 评论 -
QT4 error LNK2001: 无法解析的外部符号
转自:http://blog.csdn.net/bloodkain/article/details/7614224首先这个故事发生的环境是 QT+VS2008然后是引用别人的文章http://hi.baidu.com/%BC%BC%CA%F5%B2%BB%CA%C7%B7%B9%CD%EB/blog/item/bb22fb25fc3c552bc9955923.转载 2013-12-23 14:10:42 · 991 阅读 · 0 评论 -
VS2008 CUDA 5.5 Win7 64位配置以及项目创建配置
VS2008 CUDA 5.5 Win7 64位配置以及项目创建配置(需要图文参考的文件请到http://download.csdn.net/detail/anson2004110/5912747下载,这里实在传不上去)一.安装CUDA5.5以及配置VS助手1、安装之前必须确认自己电脑的GPU支持CUDA。在设备管理器中找到显示适配器(Displayadapters),找到转载 2013-11-15 08:47:14 · 1820 阅读 · 0 评论 -
最长回文子串
http://blog.csdn.net/sgbfblog/article/details/7979541题目描述给定一个字符串,找出该字符串的最长回文子串。回文字符串指的就是从左右两边看都一样的字符串,如aba,cddc都是回文字符串。字符串abbacdc存在的回文子串有abba和cdc,因此它的最长回文子串为abba。一个容易犯的错误初看这个问题可能转载 2013-11-28 20:56:55 · 879 阅读 · 0 评论 -
C/C++静态变量
(1)静态局部变量在函数内定义,但不象自动变量那样,当调用时就存在,退出函数时就消失。静态局部变量始终存在着,也就是说它的生存期为整个源程序。 (2)静态局部变量的生存期虽然为整个源程序,但是其作用域仍与自动变量相同,即只能在定义该变量的函数内使用该变量。退出该函数后, 尽管该变量还继续存在,但不能使用它。 (3)允许对构造类静态局部量赋初值。若未赋以初值,则由系统转载 2013-11-12 11:19:01 · 752 阅读 · 0 评论 -
error C2628: followed by 'char' is illegal (did you forget a ';'?)
error C2628: followed by 'char' is illegal (did you forget a ';'?) 出现如上的错误,查找csdn5 楼jiangsheng(蒋晟.Net[MVP])回复于 2005-01-24 01:02:15 得分 20包含的最后一个头文件末尾如果有语法错误的话,有可能造成第一行可执行代码编译出错。转载 2013-11-18 21:26:12 · 1569 阅读 · 0 评论 -
【leetcode】Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.Clarification:What constitutes原创 2014-07-17 21:20:42 · 565 阅读 · 0 评论 -
【leetcode】LRU Cache
链接:https://oj.leetcode.com/problems/lru-cache/描述:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(原创 2014-07-18 22:58:51 · 558 阅读 · 0 评论 -
【leetcode】Sort List
链接:https://oj.leetcode.com/problems/sort-list/描述:原创 2014-07-18 13:27:30 · 385 阅读 · 0 评论 -
【leetcode】Word Break && Word Break II
Word Break II 链接:https://oj.leetcode.com/problems/word-break-ii/描述:Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid原创 2014-07-22 15:54:00 · 560 阅读 · 0 评论 -
【leetcode】Linked List Cycle && Linked List Cycle II
链接:https://oj.leetcode.com/problems/linked-list-cycle-ii/Linked List Cycle II Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow原创 2014-07-21 23:00:34 · 443 阅读 · 0 评论 -
【leetcode】Candy
Candy链接:原创 2014-07-22 22:36:48 · 419 阅读 · 0 评论 -
【leetcode】Single Number && Single Number II
Single Number原创 2014-07-22 21:54:01 · 659 阅读 · 0 评论 -
【leetcode】Copy List with Random Pointer
链接:描述:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.原创 2014-07-22 17:15:22 · 413 阅读 · 0 评论 -
【leetcode】Reorder List
链接:https://oj.leetcode.com/problems/reorder-list/原创 2014-07-21 22:19:05 · 388 阅读 · 0 评论 -
【leetcode】Binary Tree Postorder Traversal
链接:https://oj.leetcode.com/problems/binary-tree-postorder-traversal/原创 2014-07-21 21:14:31 · 345 阅读 · 0 评论 -
【leetcode】Insertion Sort List
链接:https://oj.leetcode.com/problems/insertion-sort-list/描述:Sort a linked list using insertion sort.代码:原创 2014-07-18 13:56:07 · 469 阅读 · 0 评论