- 博客(49)
- 资源 (1)
- 收藏
- 关注
转载 C++多态的实现原理
用virtual关键字申明的函数叫做虚函数,虚函数肯定是类的成员函数。存在虚函数的类都有一个一维的虚函数表叫做虚表。类的对象有一个指向虚表开始的虚指针。虚表是和类对应的,虚表指针是和对象对应的。多态性是一个接口多种实现,是面向对象的核心。分为类的多态性和函数的多态性。多态用虚函数来实现,结合动态绑定。纯虚函数是虚函数再加上= 0。抽象类是指包括至少一个纯虚函数的类。纯虚函数:virtua
2016-04-18 22:10:17
685
转载 联编-迟后联编-先期联编
原博地址:http://blog.sina.com.cn/s/blog_701d49650100sg8f.html C/C++很有用的基础知识。联编指语言实现过程中合并模块、函数等代码单元生成可执行代码调用的处理过程,通常会明确地确定对每个模块、函数调用的存储器地址,把外部对它们的访问绑定正确的地址上。可以把联编分为两种类型,静态联编和动态联编。前者在编译期就确定了函数调用和函数实现之间的联系,
2016-04-08 20:35:44
1143
转载 栈区,堆区,全局区,文字常量区,程序代码区 详解
原博地址:http://blog.youkuaiyun.com/yitian20000/article/details/6358837 感觉这篇文章讲的很清晰,很详细。一、预备知识—程序的内存分配 一个由C/C++编译的程序占用的内存分为以下几个部分 1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其 操作方式类似于数据结构中的栈。 2、堆区
2016-04-08 14:24:21
445
原创 [图像处理]边缘提取以及Harris角点检测
在本周的计算机视觉与模式识别作业中,给定输入图像是两张普通A4打印纸,上面可能有手写笔记或者打印内容但是拍照时角度不正。要求输出: 1. 图像的边缘; 2. 计算 A4纸边缘的各直线方程; 3. 提取A4纸的4个角点。 作业要求的是使用C++的CImg库,与OpenCV和MATLAB相比,CImg还是有点不太方便。图像边缘的提取 这个任务比较简单,找一个像Prewitt算子、拉普拉斯
2016-03-15 15:28:41
8568
原创 [LeetCode]213 强盗入屋 II
House Robber II(强盗入屋 II)【难度:Medium】 After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all house
2016-03-13 23:59:18
1012
原创 [LeetCode]198 强盗入屋
House Robber(强盗入屋)【难度:Easy】 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of
2016-03-13 22:24:35
565
原创 [LeetCode]264 丑数 II
Ugly Number II(丑数 II)Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence
2016-03-13 21:40:35
442
原创 [LeetCode]313 超级丑数
Super Ugly Number(超级丑数)【难度:Medium】 Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For e
2016-03-13 21:30:18
1421
原创 [算法]最大子段和问题
给定长度为n的整数序列,a[1…n], 求[1,n]某个子区间[i , j]使得a[i]+…+a[j]和最大.或者求出最大的这个和.例如(-2,11,-4,13,-5,2)的最大子段和为20,所求子区间为[2,4].解题思路穷举 通过三重循环遍历所有的子段可能,取得最大和时的子段下标,简单但低效,并且当序列范围太大时,可能会超时。int begin = 0;int end = 0;int
2016-03-13 14:56:15
571
原创 [LeetCode]201 区间按位与
Bitwise AND of Numbers Range(区间按位与)【难度:Medium】 Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.For example, given the range [5, 7],
2016-03-09 14:30:21
1569
原创 [LeetCode]120 三角矩阵
Triangle(三角矩阵)【难度:Medium】 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 example, given the following triangle[ [2
2016-03-09 14:14:50
465
原创 [LeetCode]43 高精度乘法
Multiply Strings(高精度乘法)【难度:Medium】 Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative. 实现高精度非负整
2016-03-07 20:49:47
1761
原创 [LeetCode]2 两个数相加
Add Two Numbers(两个数相加)【难度:Medium】 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the t
2016-03-07 19:36:37
684
原创 [LeetCode]154 有序数组旋转后的最小值 II
Find Minimum in Rotated Sorted Array II(找到有序数组旋转后的最小值 II)【难度:Medium】 Follow up for “Find Minimum in Rotated Sorted Array”: What if duplicates are allowed?Would this affect the run-time complexity? Ho
2016-03-06 15:06:46
387
原创 [LeetCode]153 有序数组旋转后的最小值
Find Minimum in Rotated Sorted Array(找到有序数组旋转后的最小值)【难度:Medium】 Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minim
2016-03-06 15:01:52
593
原创 [LeetCode]274 H指数
H-Index(H指数)【难度:Medium】 Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index.According to the definition of h-ind
2016-03-06 14:28:39
621
原创 [LeetCode]28 实现子字符串匹配
Implement strStr() (实现子字符串匹配)【难度:Easy or Medium】 Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 返回在主字符串中出现的第一个子字符串的下标,如果不
2016-03-06 13:58:16
3089
原创 [LeetCode]145 二叉树后序遍历
Binary Tree Postorder Traversal(二叉树后序遍历)【难度:Medium】 Given a binary tree, return the postorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, return [3,2,1].Note: Recursiv
2016-03-05 17:32:33
1124
原创 [LeetCode]94 二叉树中序遍历
Binary Tree Inorder Traversal(二叉树中序遍历)【难度:Medium】 Given a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, return [1,3,2].Note: Recursive so
2016-03-05 17:25:40
1224
原创 [LeetCode]144 二叉树先序遍历
Binary Tree Preorder Traversal(二叉树先序遍历)【难度:Medium】 Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, return [1,2,3].Note: Recursive
2016-03-05 17:19:13
1545
原创 [LeetCode]41 第一个缺失的整数
First Missing Positive(第一个缺失的整数)【难度:hard】 Given an unsorted integer array, find the first missing positive integer.For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2.Your algorithm should
2016-03-05 16:33:24
638
原创 [LeetCode]268 消失的数字
Missing Number(消失的数字)【难度:Medium】 Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.For example, Given nums = [0, 1, 3] return 2.Note:
2016-03-05 15:36:12
912
原创 [LeetCode]44 通配符的匹配
Wildcard Matching(通配符的匹配)【难度:Hard】 Implement wildcard pattern matching with support for ‘?’ and ‘*’.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequen
2016-03-05 15:24:23
516
原创 [LeetCode]4 两个有序数组的中位数
Median of Two Sorted Arrays(两个有序数组的中位数)【难度:hard】 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sho
2016-03-05 01:32:24
14888
3
原创 [LeetCode]334 三个递增数字子序列
Increasing Triplet Subsequence(三个递增数字子序列)【难度:Medium】 Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should: Return true
2016-03-04 18:26:53
1320
原创 [LeetCode]215 数组第k大的数
Kth Largest Element in an Array(数组第k大的数)【难度:Medium】 Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For exa
2016-03-04 00:18:03
15654
1
原创 [编译原理]实现AQL Subset
AQL Subset的实现是我们学校软件工程编译原理课程的期末项目,其目的在于通过实现一个简单的编译器来加深学生对编译原理,如语言和文法、词法分析、语法分析等过程的理解,可以帮助学生深入认识编程的思想,编译器的底层实现。本文用于总结整个项目过程中遇到的难点,以及一点点个人经验。什么是AQL全称:Annotation Query Language用于Text Analytics,可以从非结构化或半
2016-03-03 12:21:17
1051
原创 [LeetCode]40 和的组合 II
Combination Sum II(和的组合 II)【难度:Medium】 Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may
2016-03-03 00:07:41
339
原创 [LeetCode]39 和的组合形式
Combination Sum(和的组合形式)【难度:Medium】 Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be
2016-03-02 14:15:31
258
原创 [LeetCode]332 航程重建
Reconstruct Itinerary(航程重建)【难度:Medium】 Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong
2016-03-02 00:34:29
2010
原创 [LeetCode]33 旋转后的有序数组中的搜索
Search in Rotated Sorted Array(旋转后的有序数组中的搜索)【难度:hard or Easy】 Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a
2016-03-01 23:54:32
423
原创 [LeetCode]136 单一的数字
Single Number(单一的数字)【难度:Medium】 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 im
2016-03-01 16:29:46
329
原创 [LeetCode]67 二进制相加
Add Binary(二进制相加)【难度:Easy】 Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.给定两个二进制数的字符串,以字符串形式返回他们的和。 如: a = “11” b = “1” return “10
2016-03-01 16:11:40
352
原创 [LeetCode]16 最接近的三者之和
3Sum Closest(最接近的三者之和)【难度:Medium】 Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume
2016-02-29 22:32:13
401
原创 [LeetCode]15 三者之和
3Sum(三者之和)Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: Elements in a triplet (a,b,c)
2016-02-29 21:32:26
281
原创 [LeetCode]1 两者之和
Two Sum(两者之和)【难度:Easy】 Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution. Example
2016-02-29 20:37:12
334
原创 [LeetCode]105 根据先序遍历和中序遍历构建二叉树
Construct Binary Tree from Preorder and Inorder Traversal(根据先序遍历和中序遍历构建二叉树)【难度:Medium】 Given preorder and inorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates d
2016-02-29 14:32:14
1546
原创 [LeetCode]106 根据中序遍历和后序遍历构建二叉树
Construct Binary Tree from Inorder and Postorder Traversal(根据中序遍历和后序遍历构建二叉树)【难度:Medium】 Given inorder and postorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates
2016-02-29 14:23:25
2743
原创 [LeetCode]236 二叉树的最近公共父亲节点
Lowest Common Ancestor of a Binary Tree(二叉树的最近公共父亲节点)Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowe
2016-02-28 20:52:17
6869
原创 [LeetCode]235 二叉查找树的最近公共父亲节点
Lowest Common Ancestor of a Binary Search Tree(二叉查找树的最近公共父亲节点)【难度:Easy】 Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definitio
2016-02-28 20:39:10
3202
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人