C++
文章平均质量分 79
bayingbf
我会拼尽我的所有!
展开
-
20141215-Amazon Intern F2F Interview Experence
面试前准备 面试通知是上周四发过来的,主要是说明了下时间和地点,没什么特别的。实习要求也没什么特别之处,只是写了下基本要求,像VC、C++这样的硬性要求等。这里主要谈谈对于此次面试和之前几次面试类似要求的实习岗位的几点总结吧。 说实话,以前面试经历还是比较少的,只是暑期前随便投递了一个公司,结果面了两面就过了,也没有再投递其他公司,就这样进到公司实习了。总的来说这次面试经历对我有很大的原创 2014-12-15 21:26:58 · 1147 阅读 · 0 评论 -
更改内存分配策略改善归并排序效率
归并排序是一种相当稳健的排序算法,无论何种输入序列,其期望时间复杂度和最坏时间复杂度都是Θ(nlogn),这已经达到了基于比较排序算法的渐进下界。因此归并排序时常会用于对可能导致quicksort退化的序列排序。归并排序是典型的分治算法,一个最常见的实现如下:void mergeSort(int a[], const int low, const int high) { if (low <转载 2015-03-30 18:48:07 · 1747 阅读 · 0 评论 -
关于结构体的内存分配问题--sizeof(/*struct*/A)
问题描述:C、C++中的结构体 struct A{变量列表}; 是定义类的一种方式,与class 关键字类似,同样可以定义继承方式为public、private、protected三种方式,但是不同的是一点是,struct默认集成方式为public,而class默认继承方式为private。- 两者的内存分配具体方式都需要考虑 内存对齐 问题。 - 这里先分析struct的内存分配方式基本类型的原创 2015-03-22 10:21:34 · 831 阅读 · 0 评论 -
new/delete和malloc/free异同
在C++中当我们不清楚将要使用的内存空间参数(size == n)时,比如在一个函数intFibonacci(const int n){} 中,如果使用空间换时间的方法,我们将要分配一个整型指针数组int *temp, 但是,这个数组的大小该是多少就是不确定的。在C语言里使用的是int * temp = (int *) malloc (sizeof(int) * n); 而最后需要将所申请原创 2015-03-10 07:50:29 · 636 阅读 · 0 评论 -
LeetCode Num34_Search for a Range
问题描述: Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target原创 2015-01-04 11:37:19 · 678 阅读 · 0 评论 -
LeetCode Num64_Minimum Path Sum
问题描述: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either d原创 2015-01-02 08:26:51 · 731 阅读 · 0 评论 -
20141210-实习面试经历
昨天晚上在应届生求职网看到了北大Google创业团队招聘软件工程师及实习生的信息,仔细查看职位要求后在今天(12.10)上午10点左右通过Email投递了简历。处理效率很快,中午12点左右就收到了那边团队的电话,简单了解了我的基本情况后,定了下午2点的面试,地点在北大的理科楼。 通过这我得到了如下信息: i. 一般创业团队发招聘信息,肯定是很需要人才的,一般你慎重考虑符合基本条件后,发原创 2014-12-11 00:26:04 · 916 阅读 · 0 评论 -
Analysis on “Container With Most Water ”
Container With Most Water Problem: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints o原创 2014-12-05 13:54:46 · 573 阅读 · 0 评论 -
20141204-关于使用C++标准输入输出库:iostream的一点思考
转载请注明出处~ iostream(In and Out stream)是C++语言中标准库(standard library)中提供IO机制的函数库,包含两个基础类型istream和ostream,分别表示输入流和输出流。一个“流”指的就是一个字符序列,表示从IO设备读出或写入IO的。“流”(stream)即:随着时间的推移,字符是顺序产生或消耗掉的; 标准输入输出库中定义了四种对象原创 2014-12-04 11:13:13 · 902 阅读 · 0 评论 -
LeetCode Num74_Search a 2D Matrix
问题描述: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The firs原创 2015-01-06 19:29:25 · 698 阅读 · 0 评论 -
HiHoCoder-第三十九周--二分·归并排序之逆序对
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述在上一回、上上回以及上上上回里我们知道Nettle在玩《艦これ》。经过了一番苦战之后,Nettle又获得了的很多很多的船。 这一天Nettle在检查自己的舰队列表:我们可以看到,船默认排序是以等级为参数。但实际上一个船的火力值和等级的关系并不大,所以会存在A船比B船等级高,但是A船火力却低于B船这样的情况。比如上图中原创 2015-03-30 19:14:22 · 726 阅读 · 0 评论