- 博客(51)
- 收藏
- 关注
转载 [网络拾遗] 详解IP地址后面斜杠加具体数字
详解IP地址后面斜杠加具体数字 其实这个就是用CIDR(无类别域间路由选择,Classlessand Subnet Address Extensions and Supernetting))的形式表示的一个网段,或者说子网。 我们知道确定一个子网需要知道主机地址和子网掩码,但用CIDR的形式,可以简单得到两个数值。举例说吧,192.168.0.0/24”就表示,这
2014-08-26 09:31:59 1771
原创 关于所谓的左值和右值,完全是翻译错误啊!
L-value中的L指的是Location,表示可寻址。The "l" in lvalue can be though of as locationR-value中的R指的是Read,表示可读。The "r" in rvalue can be thought of as "read" value.
2014-08-25 16:56:28 503
转载 [转]关于栈和堆的区别
转载自堆和栈的区别 一、预备知识—程序的内存分配 一个由C/C++编译的程序占用的内存分为以下几个部分 1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其 操作方式类似于数据结构中的栈。 2、堆区(heap) — 一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回 收 。注意它与数据结构中的堆是两回事,分配方式倒是
2014-08-05 15:29:55 327
转载 [转]C++构造函数
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://ticktick.blog.51cto.com/823160/194307 c++构造函数的知识在各种c++教材上已有介绍,不过初学者往往不太注意观察和总结其中各种构造函数的特点和用法,故在此我根据自己的c++编程经验总结了一下c++中各种构造函数的特
2014-08-02 22:25:32 479
原创 [LeetCode] Divide Two Integers
Divide two integers without using multiplication, division and mod operator.
2014-08-02 22:21:12 433
原创 [LeetCode] Minimum Window Substring !
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BAN
2014-08-02 21:59:14 419
原创 [LeetCode] Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.
2014-08-02 21:55:20 380
原创 [LeetCode] Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers
2014-08-02 21:52:04 308
原创 [LeetCode] Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of
2014-08-02 21:46:16 307
原创 [LeetCode] Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2,1] ha
2014-08-02 21:34:23 423
原创 [LeetCode] Single Number II
Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without usi
2014-08-02 21:26:50 323
原创 [LeetCode] Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?其实想想
2014-08-02 21:22:51 294
原创 [LeetCode] Linked List Cycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?四个字:快慢指针。
2014-08-02 21:18:48 398
原创 [LeetCode] Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \
2014-08-02 21:17:03 363
原创 [LeetCode] Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on
2014-08-02 21:07:45 345
原创 [LeetCode] Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before c
2014-08-02 21:03:29 283
原创 [LeetCode] Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
2014-08-02 21:01:29 331
原创 [LeetCode] Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
2014-08-02 20:55:06 470
原创 [LeetCode] Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ext
2014-08-02 20:49:03 342
转载 [转]UML类图几种关系的总结
转载自:http://blog.csdn.net/tianhai110/article/details/6339565在UML类图中,常见的有以下几种关系:泛化(Generalization), 实现(Realization),关联(Association),聚合(Aggregation),组合(Composition),依赖(Dependency) 1.泛化(General
2014-08-02 20:44:20 384
转载 [转]C++中的抽象类以及接口的区别联系
抽象类和接口抽象类:抽象类是特殊的类,不能被实例化(将定义了纯虚函数的类称为抽象类);除此以外,具有类的其他特性;重要的是抽象类可以包括抽象方法,这是普通类所不能的,但同时也能包括普通的方法。抽象方法只能声明于抽象类中,且不包含任何实现,派生类必须覆盖它们。另外,抽象类可以派生自一个抽象类,可以覆盖基类的抽象方法也可以不覆盖,如果不覆盖,则其派生类必须覆盖它
2014-08-02 15:59:12 341
转载 [转]C++拷贝构造函数详解
转载自:http://blog.csdn.net/lwbeyond/article/details/6202256?reload一. 什么是拷贝构造函数首先对于普通类型的对象来说,它们之间的复制是很简单的,例如:[c-sharp] view plaincopyint a = 100; in
2014-07-30 23:56:08 311
原创 天将降大任于斯人
孟子曰:“舜发于畎亩之中,傅说举于版筑之间,胶鬲举于鱼盐之中,管夷吾举于士,孙叔敖举于海,百里奚举于市。 故天将降大任于是人也,必先苦其心志,劳其筋骨,饿其体肤,空乏其身,行拂乱其所为,所以动心忍性,曾益其所不能。人恒过,然后能改;困于心,衡于虑,而后作;征于色,发于声,而后喻。入则无法家拂士,出则无敌国外患者,国恒亡。然后知生于忧患而死于安乐也。”
2014-07-28 14:30:12 798
原创 [LeetCode] Valid Number
Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguo
2014-06-24 11:57:41 500
转载 C++中const用法总结
1. const修饰普通变量和指针const修饰变量,一般有两种写法:const TYPE value;TYPE const value;这两种写法在本质上是一样的。它的含义是:const修饰的类型为TYPE的变量value是不可变的。对于一个非指针的类型TYPE,无论怎么写,都是一个含义,即value只不可变。例如:
2014-05-28 19:43:09 562
转载 C++四种cast操作符
C 风格(C-style)强制转型如下:(T) expression 或T(expression) //函数风格(Function-style)两种形式之间没有本质上的不同。对于具有转换的简单类型而言C 风格转型工作得很好。然而,这样的转换符也能不分皂白地应用于类(class)和类的指针。ANSI-C++标准定义了四个新的转换符:reinterpret_cast, stati
2014-05-28 19:34:54 679
转载 C++虚函数表解析
转载自:http://blog.csdn.net/haoel/article/details/1948051/C++ 虚函数表解析 陈皓http://blog.csdn.net/haoel 前言 C++中的虚函数的作用主要是实现了多态的机制。关于多态,简而言之就是用父类型别的指针指向其子类的实例,然后通过父类的指针调用实际子类的成员函数。这种技术可以让
2014-05-28 18:03:37 590 1
原创 [LeetCode]Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine i
2014-05-17 09:33:16 501
原创 [LeetCode]Sort List
Sort a linked list in O(n log n) time using constant space complexity.zhed
2014-05-16 14:40:25 393
原创 [LeetCode]Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.本题关键是
2014-05-16 14:29:05 495
原创 [LeetCode]Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1",
2014-05-16 14:17:34 504
原创 [LeetCode]Reverse Words in a String
#include #include #include using namespace std;class Solution{public: void reverseWords(string &s) { string st; for (int i = s.length() - 1; i >= 0;) { while (i >= 0 && s.at(i) == '
2014-05-16 14:11:22 535
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人