由买买提看人间百态

topics

全部话题 - 话题: reallocate
首页 上页 1 2 3 4 5 下页 末页 (共5页)
g********2
发帖数: 6571
1
Hillary’s rumored running mate, Housing Secretary Julian Castro, is cooking
up a scheme to reallocate funding for Section 8 housing to punish suburbs
for being too white and too wealthy.
The scheme involves super-sizing vouchers to help urban poor afford higher
rents in pricey areas, such as Westchester County, while assigning them
government real estate agents called “mobility counselors” to secure
housing in the exurbs.
Castro plans to launch the Section 8 reboot this fall, even though a simil... 阅读全帖
g********2
发帖数: 6571
2
这是有关奥巴马住房计划的介绍:
Obama’s last act is to force suburbs to be less white and less wealthy
Hillary’s rumored running mate, Housing Secretary Julian Castro, is cooking
up a scheme to reallocate funding for Section 8 housing to punish suburbs
for being too white and too wealthy.
The scheme involves super-sizing vouchers to help urban poor afford higher
rents in pricey areas, such as Westchester County, while assigning them
government real estate agents called “mobility counselors” to secure
housing in... 阅读全帖
m********n
发帖数: 211
3
来自主题: USANews版 - 也说liberalism和conservatism
美国以抗税开国,现在两党政争,也离不开怎么花钱的问题,而不是隔壁楼上讲的
liberal -> progressive vs. conservative 那么简单。
说穿了,一个是根本上的政策问题,另一个是怎么去包装,建立政治联盟,以图赢得大
多数选票的问题。两者互为倚靠,但不能混为一谈。
以wealth allocation为例,共和党基本上是反对的,民主党虽然遮遮掩掩扭扭捏捏,
但基本上是这么做的。从意识形态的角度而言,两者各有自己的理论基础和历史由来;
而从政治联盟的角度来看,共和党向来注重维持既得利益阶层的现状,而民主党则以拉
拢穷人,女人以及少数族裔为主,这样一来,和两党的税收政策正好相辅相成,但很难
辨别谁是因谁是果。
所以讲到liberalism或者是conservatism,这个是两党打出来的招牌,就看谁的魅惑指
数更高了,而未见得是立党之本。大家都看不上奥巴马,可不能不承认他搭的这个帐篷
有够大,比共和党搭的大。毛泽东作调查研究,搞阶级分析,也是为了达到这个目的,
民族资产阶级,中农,知识分子,都是要争取的对象;革命成功以后,又是另一回事了。
这不,讲到trump,共... 阅读全帖
c******e
发帖数: 2503
4
根本没退出VA
Trump’s campaign, however, released this statement today:
“We remain absolutely committed to winning in Virginia. While we’re
reallocating some of our staff strategically to accommodate early voting in
nearby priority states such as North Carolina, our campaign leadership and
staffing remains strong in Virginia. Together with the RNC and the state
Party, we will have all the resources we need to re-take the Commonwealth at
the Presidential level in November, as historically early voting ... 阅读全帖
b***n
发帖数: 13455
5
来自主题: USANews版 - Trump团队放弃Virginia
泡软政变后遗症
http://www.foxnews.com/politics/elections/2016/events/elections-2016-live-blog
October 13, 2016 10:31am
Trump campaign pushes back on claim they’re abandoning Virginia
The Trump campaign is pushing back on an NBC report suggesting the campaign
is pulling out of Virginia.
Sources told NBC News that GOP strategists were left “blindsided” after
the decision came down late Wednesday from Trump headquarters. The report
cited a source saying the campaign is shifting focus to Pennsylvania,Flori... 阅读全帖
j*******r
发帖数: 412
6
来自主题: USANews版 - 犹他好消息
赞楼主实干精神。
歪楼问题答案:
"We remain absolutely committed to winning in Virginia. While we're
reallocating some of our staff strategically to accommodate early voting in
nearby priority states such as North Carolina, our campaign leadership and
staffing remains strong in Virginia.
Together with the RNC and the state Party, we will have all the resources we
need to re-take the Commonwealth at the Presidential level in November, as
historically early voting in Virginia is much less of a focus for both
part... 阅读全帖

发帖数: 1
7
来自主题: USANews版 - 山道士+巫婆+DNC大合唱
Quotes from comments:
They used him to bring in all the young college kids and get them adapted to
scoialist ideas. Took their money too. Built enthusiasm for democrats and
have their idol (bernie) bash Trump.
All that Bernie donation money that wasn't spent got reallocated to Clinton
per DNC rules... jesus. Bernie supporters got scammed into donating to HRC
by proxy. This is fraud. (In the interest of truth, his is what I was told
and could not independently verify when looking it up)

发帖数: 1
8
https://conservativedailypost.com/sanctuary-city-just-humiliated-democrats-
ask-forgiveness-federal-funding-reallocated/?utm_source=Push&utm_campaign=20
_Feb-2&utm_medium=OneSignal
庇护城市快撑不住了,民主党要求宽恕作为联邦资助重新分配
W*****B
发帖数: 4796
9
【 以下文字转载自 Military 讨论区 】
发信人: WCNMLGB (CCC), 信区: Military
标 题: 床铺的移民政策即使成功实施也只能将白人成为少民进程推迟5年
发信站: BBS 未名空间站 (Tue Feb 6 17:13:06 2018, 美东)
床铺螳臂当车,白人成为少民已是大势所趋。美国即使现在完全停止移民,白人最终也
将成为少民。只是时间早晚问题。
ANALYSIS
President Trump's proposal to cut legal immigration rates would
delay the date that white Americans become a minority of the population by&#
160;as few as one or as many as five additional years,
according to an analysis by The Washington Post.
The plan, released by the White... 阅读全帖
t********i
发帖数: 7856
10
英文版也贴一下:
http://asianamericanforeducation.org/pr_20180606/
AACE Condemns de Blasio’s Proposed Changes on NYC Specialized High School
Admissions Process
June 6th, 2018
Livingston, New Jersey. Asian American Coalition for Education (AACE)
denounces New York Mayor de Blasio’s proposal to phase out the Specialized
High School Admissions Test (SHSAT) as politically motivated,
unconstitutional, and unjust. De Blasio also plans to reallocate 20% of the
admission quotas for lower performing students fro... 阅读全帖
b*****d
发帖数: 61690
11
来自主题: USANews版 - 陆军找到了250亿的saving
The Army’s top civilian on Monday said the service has found $25 billion in
its budget that it will reallocate to new priorities over the next five
years.
Secretary Mark Esper said the savings would come from positions in equipping
, he told reporters at the Association of the U.S. Army’s annual conference
in Washington.
He said the Army earlier this year began assessing how necessary certain
programs are to meet major modernization plans.
“Priorities are priorities and hard choices must be made... 阅读全帖
q*******7
发帖数: 29
12
来自主题: Automobile版 - 请教保险空白区(Insurance Gap)
由于reallocation,车卖了,保险也准备报停。本打算到了新的地方,买了车后再继续
买车险。可今天跟保险公司提终止车险时,对我建议,不要完全终止车险,采用低费“
托管”。理由是,完全终止合同,会出现车险时间上不连续,哪怕只有一天的gap,对
下一份车险会有影响。
第一次听说,有点意外。上来请教有类似经历的车友。这是否属实?有没更好的点子?
感谢。
q*******7
发帖数: 29
13
来自主题: Automobile版 - 请教保险空白区(Insurance Gap)
由于reallocation,车卖了,保险也准备报停。本打算到了新的地方,买了车后再继续
买车险。可今天跟保险公司提终止车险时,对我建议,不要完全终止车险,采用低费“
托管”。理由是,完全终止合同,会出现车险时间上不连续,哪怕只有一天的gap,对
下一份车险会有影响。
第一次听说,有点意外。上来请教有类似经历的车友。这是否属实?有没更好的点子?
感谢。
l******o
发帖数: 279
14
来自主题: Faculty版 - 请教NSF Funding的使用
没有问题,只有不是PI暑期工资变化这种,学校可以决定.
“c. Post-Award
During the performance of a project, it may be appropriate for funds to be
reallocated to support advancement of the project. Awardees have broad
discretion to rebudget within the cost and administrative principles. Unless
otherwise stated in the award or as noted below, the awardee is authorized
to transfer funds from one budget category to another for allowable
expenditures. Significant budget changes that reflect changes in objectives,
scope or in th... 阅读全帖
G*******n
发帖数: 3144
15
来自主题: HouseRental版 - 紧急求助啊~~~[求租房建议] (转载)
【 以下文字转载自 NewJersey 讨论区 】
发信人: GentleWen (砖头、文), 信区: NewJersey
标 题: 紧急求助啊~~~[求租房建议]
发信站: BBS 未名空间站 (Mon Sep 26 18:48:05 2011, 美东)
在NJ找到工作 这两天估计就要开始上班了
地点在Florham Park, NJ 07932
是contractor 所以猎头安排啥时候开始上班 reallocation什么的
但估计就给我报销几天的酒店
所以还是得马上找房子住
我在craiglist上翻过 没啥有用的信息
我上班的地方公交挺不方便的
从单位到最近的公交就是morris&essex line..
暂时没车 希望在这条线的沿线附近区域吧
求助下这附近找房子有什么途径?
希望尽量能租中国人house的一室一厅 两室一厅 studio之类的
不知道当地有没有中文的local news paper有租房信息等
像纽约的星岛日报啥的
现在真是一筹莫展啊
c*****8
发帖数: 23
16
转租:
小区:Washington Crossing (Apartment)
网站: http://www.bozzuto.com/apartments/communities/219-washington-crossing
地址: 55 Cedar Street, Woburn, MA
位置极佳: 位于I95与I93交界处,从小区步行3分钟就是BJ's, 小区对面的Cummings
Park商业区里更是各种商店和饭店包括很出名的寿司店Maki Maki, 5分钟开车到
Woburn Mall/Marketbasket/Khols/Lowes/CVS/New China Pearl (广式早茶,这个是我
见过的新英格兰地区最大的了), 5分钟到位于Woburn downtown的老西安(如果你喜欢
吃面食,原来在Chelmsford,搬家了),10分钟到Burlington Mall/HMART/
Marketbasket, 25分钟到波士顿.
About 1300 sqft, 坐北朝南,窗户大,阳光充足,两个卧室,其中一个带卫生间,另
一个卫生间在另一个卧室对面。有一个书房(Den)... 阅读全帖
h***y
发帖数: 834
17
昨天在网上操作了reallocate balance,将balance全转入了money market,今天发现
balance上少了110块,是收手续费了吗? 还是亏的钱啊?
l**i
发帖数: 176
18
来自主题: Investment版 - 请问401k里如何买卖MF?
我的401k在prudential,如果每个月contribute 100刀,分别买3个MF。
现在想都换到Money Market Fund,是不是用transfer/reallocate current money?
可是不是说买了MF后不到3个月卖,就要收redemption fee吗?
我每个月都买一点的啊,这样前三个月买的就不能转MMF了?
价格一直都变,哪能知道三个月以前买的现在是多少钱了啊。
另外,这个转钱不收费吧。
多谢
D*****t
发帖数: 558
19
来自主题: Investment版 - 该不该卖掉401K里的PIMCO Total Return
you should ask yourself why you have 90% of your 401k allocated to one
single bond fund in the first place. ( you are not in your retirement age,
right?) shouldn't you have a more balanced allocation between stock and bond
? yes, you definitely should sell some of it and reallocate the money into
equity.
have a balanced and diversified portfolio. don't pick "hot" fund . don't
chase performance. these are the basics for long term investment.
S**C
发帖数: 2964
20
来自主题: Investment版 - 什么时候卖fund?
You should consider your taxable, 401(k), 529, IRA etc. as a whole. You may
decide which account to hold what, given tax, risk and time horizon
consideration.
FWIW, our taxable are mostly individual stocks, with some ETFs and MFs. I am
in the process to reallocate my actively managed funds to tax advantaged
accounts.

portforlio
d**w
发帖数: 122
21
来自主题: Investment版 - 401K中request reallocation 多久生效?
虽然版上大多数不赞成在这个时候调整401K的在股票还是现金的比例,但是感觉下半年
的几个月不会有大的涨幅了, 想把80%股票转成40%股票,这个request要多久生效? 30天
吗? 每次调整比例(基金种类还是一样,一个equity的和一个money market)要收费吗?
频繁调整是不是不好? 我指半年左右调整下.多谢!
s******e
发帖数: 2181
22
来自主题: Investment版 - 401K中request reallocation 多久生效?
当天收盘后几小时内生效。
有的基金卖的时候会收fee,有的不要,你最后点确认前看一下就知道了。
我原来每2-3个月甚至更久调整一次,最近股市波动太剧烈,我已经恶化到每10天调整
一次了。
r****m
发帖数: 1204
23
来自主题: Investment版 - 教育fund可以用来付私校的费用?
Under the new tax law, 529 plan funds can be used to pay for private school
expenses, but I think it's still a 鸡肋, because:
1) Most plans don't have good fund choices and are often loaded with fees;
2) It's not easy to do asset reallocations as market situation changes; In
fact, as tax qualified plan, such frequently moves are disallowed.
3) If your investment has a loss, you can't claim a loss; technically you
can, but you have to close the account, and the loss has to be over 2% of
your AGI.
I... 阅读全帖
j*****g
发帖数: 10
24
来自主题: JobHunting版 - Bloomberg电话面经
上个月在bloomberg网站上投的简历,过了两个星期收到online assessment的link,我
选的是C,题目和brainbench上的差不多,做的感觉一般,问了很多偏僻的C的用法,不
过最后还是过了。做完题第二天马上收到HR的信schedule phone interview,被安排在
本周店面。
interviewer是两个印度人,口音一般重,上来就问了最近的一个project,问得很
detail,花了大概10分钟左右。然后开始正式考察编程问题,并且问我对哪种语言最熟
悉,我仍然选择了C。题目比较简单,和板上大家讨论的差不多:
1. C基础问题,指针,malloc,realloc,free,比较shallow copy和deep copy传参,比
较heap和stack内存分配.
2. 实现 int sqrt(int); 我以前在micro-controller实现过,采用的是wiki上面的
babylonian算法(http://en.wikipedia.org/wiki/Methods_of_computing_square_roots),不过似乎不是他们想要的方
s*****r
发帖数: 773
25
来自主题: JobHunting版 - C++ 面试题目分享(1)
C/C++ Interview Questions
how do you find out if a linked-list has an end? (i.e. the list is not a
cycle)
You can find out by using 2 pointers. One of them goes 2 nodes each time.
The second one goes at 1 nodes each time. If there is a cycle, the one that
goes 2 nodes each time will eventually meet the one that goes slower. If
that is the case, then you will know the linked-list is a cycle.
What is the difference between realloc() and free()?
The free subroutine frees a block of memory previousl
I**********s
发帖数: 441
26
来自主题: JobHunting版 - Google点面
问了1) 研究, 2) 多线程程序设计, 3) 任意无穷字符串流, 内存有限, 找出唯一一对
重复字符串, 这个我说了哈希表和外部排序, 但是面试人说有更好的办法(后来想也许
是bloom filter), 然后追问外部排序的细节到结束. 估计要挂 :(
总结: 面试既是技术活, 又是运气活.
无论如何, 把我的准备工作放下面, 攒点rp, 希望对大家有所帮助.
Interview Qs
Data Structures
1. Integer
- find number of 1s
- next largest smaller
- smallest larger number
- determine if is palindrom
- itoa, atoi
- add 2 numbers w/o using + or arithmetic operators
- implement *, -, / using only +
- find max of two numbers w/o co... 阅读全帖
B*******g
发帖数: 1593
27
来自主题: JobHunting版 - 攒人品 贴个Bloomberg phone interview.
运气好 问到的都是很简单的问题 C++ STL...
1. 4 default functions in C++
2. For non built-in type, how to prevent client from passing by value
3. Program crashed, what u do?(I said fault handlers with stack trace,log
files blahblah)
4. STL vector what happens when insert() push_back() pop_back()are called.
我答的很笼统 主要就是注意到memory reallocation还有将所有元素移到新的内存地址
的问题 顺便
问到了vector里面是user defined type时要定义copy constructor 以及shallow deep
copy
5. set 和 hash_map的区别 我没讲全 他也没追问细节
6. file with strings, use STL containers to fin
P*******b
发帖数: 1001
28
realloc?不知道到底想考啥
s*****n
发帖数: 5488
29
来自主题: JobHunting版 - Linked Lists vs. Arrays
linked list和array也就是第一轮店面的基本问题吧。这里的答案很多多余而且是错的。
如果linked list是动态分配内存,overhead相当高。小的malloc代价是64B above
.大的malloc是128b above.
grow:array也能realloc,除非你生成在stack上,否则也可以在地址空间无限扩展。
箭头那个,maybe for sequential scan, 但是提高相当有限度。

that
s*********g
发帖数: 153
30
来自主题: JobHunting版 - Bloomberg面经+个人找工作小感
书面合同已经拿到,工资为Bloomberg给FSD的市场价,reallocation费几千,没有股
票,无论怎样,目前只有公司挑人,没有人挑公司,对于我这个初入社会的人,不从也
得从了。
Bloomberg面经:
第一轮,两个senior,
先问TA,RA经验,我淘淘不绝,扯了15分钟,他们还觉得不够,抓住细节,死扣问我问
题,我只好努力解释。。。又过了10分钟,总算在项目问题上放手了。设计问题,有一
堆股票,还有股票值,不断更新,如何在某一时刻返回,前20大股票值和其对应的股票
公司,大概是一个map 键与值的转换问题。
第二轮,一个senior。
上来写code,写一个Vector class,包括构造函数,析构函数,push_back操作等等,
中间夹在各种C++细节问题。第二题,找一个missing num 在99个数中,num范围(1<=x
<=100),99个数互不重复。第三题,什么是map,插入,删除,搜索时间复杂度,什么
是hashing,和map比较。第四题,三个人站在三角形不同的顶点上,同时跑,不相遇的几
率是多少?
第三轮,又一个senior,
请问什是多态... 阅读全帖
G***n
发帖数: 877
31
来自主题: JobHunting版 - A malloc/free question using C/C++
Hi,
I have a question using C. I want to
allocate the memory using realloc() or
malloc() inside a function fun(), the
return of this function is the pointer
pointing to the allocated memory. There
is no free() inside fun(), because I
need to grasp the allocated memory in
fun() by its return.
In the main function, I define char
*pStr= fun() to call this function and
then try to free pStr later using
free(pStr). The program runs forever at
free(pStr) there. However, if I do not
use free() function... 阅读全帖
z****u
发帖数: 104
32
来自主题: JobHunting版 - 问个Amazon面试题
C version,求指正
int NextNumber(int i)
{
int max_length = 1;
int* digits = (int*) malloc(sizeof(int) * max_length);
/* break number down to digits */
int idx = 0;
while(i)
{
if (idx > max_length - 1)
{
max_length *= 2;
digits = (int*) realloc(digits, sizeof(int) * max_length);
}
digits[idx++] = i % 10;
i /= 10;
}
int length = idx;
/* find the break digit */
for (idx = 1; idx < length; idx++)
... 阅读全帖
l******c
发帖数: 2555
33
what are you doing?
so many alloc, realloc
can you test
aab
z****u
发帖数: 104
34
没有考虑重复字母的问题,所以测试 aab 肯定通不过
主要考虑的是 permutation 出来的字符串的存储,所以用了很多 malloc 和 realloc
,不过现在想起来我其实完全可以在开始就用一个 malloc 搞定的。
写代码前没动脑子,出来就是这个效果了, /sigh,水平亟待提高啊
l******c
发帖数: 2555
35
if your code is designed by yourself, not learned elsewhere, you are above
the average level on this board.
most learned this algorithm from others.

realloc
S**I
发帖数: 15689
36
☆─────────────────────────────────────☆
gzou (gzou) 于 (Thu May 12 02:26:35 2011, 美东) 提到:
马上就要G on site了,
求祝福。
下面是从本版收集到的Google的试题,便于大家查询。
申明:有的附带有解释说明的,也来自于本版或者网络,大家自己看, 不保证真确
http://www.mitbbs.com/article_t1/JobHunting/31847453_0_1.html
本人ECE fresh PhD,背景是电路/EDA,跟G业务基本没什么关系
同学内部推荐的,很简单的一次电面就给了onsite
题都不难,但是自己没把握好机会,出了一些小bug。
总的感觉,出错就是硬伤,宁可从最简单的算法写起,也不能出错。
电面:
1,Skip list, http://en.wikipedia.org/wiki/Skip_list
写code实现struct skip_list * find(struct skip_list *head, int value)
2,sorted array... 阅读全帖
S**I
发帖数: 15689
37
☆─────────────────────────────────────☆
gzou (gzou) 于 (Thu May 12 02:26:35 2011, 美东) 提到:
马上就要G on site了,
求祝福。
下面是从本版收集到的Google的试题,便于大家查询。
申明:有的附带有解释说明的,也来自于本版或者网络,大家自己看, 不保证真确
http://www.mitbbs.com/article_t1/JobHunting/31847453_0_1.html
本人ECE fresh PhD,背景是电路/EDA,跟G业务基本没什么关系
同学内部推荐的,很简单的一次电面就给了onsite
题都不难,但是自己没把握好机会,出了一些小bug。
总的感觉,出错就是硬伤,宁可从最简单的算法写起,也不能出错。
电面:
1,Skip list, http://en.wikipedia.org/wiki/Skip_list
写code实现struct skip_list * find(struct skip_list *head, int value)
2,sorted array... 阅读全帖
i*********7
发帖数: 348
38
来自主题: JobHunting版 - 这题in place 做不了吧?
走一遍计算空间,如果要求空间大于所指定空间。
realloc一下。我觉得这也算inplace的。
d****n
发帖数: 1637
39
来自主题: JobHunting版 - 昨天的F家店面
差不多用了30分钟
#define BSZ 4096
char buffer[BSZ];//buffer same size as 4096
int curr=BSZ-1; //current position read in buffer
int eof=0; //eof flag
extern char * read4096();
char *getline(){
char *s; //return string
int i, ssz=0; //size of s
for(;;){
if (!eof){
if (curr==(BSZ-1)) {
strcpy(buffer, read4096()); //read API
curr=0;
if (strlen(buffer)<4096 ) e... 阅读全帖
r****k
发帖数: 21
40
来自主题: JobHunting版 - 昨天的F家店面
#define MAX_BUFFER_SIZE 4096
extern char *read4096();
char buffer[MAX_BUFFER_SIZE+1];
char *readline()
{
static int EOF = 0;
static int currentPos = MAX_BUFFER_SIZE;

char *s = NULL;
int i, ssz = 0;

for(;;)
{
if (!EOF)
{
// buffer is not empty, check buffer
if (currentPos != MAX_BUFFER_SIZE)
{
for ( i = currentPos; i < MAX_BUFFER_SIZE; i++)
if (buffer[i] = '\0' || buffer[i] = '... 阅读全帖
n******e
发帖数: 957
41
打到卡上还是采用报销的形式呢?
t*********h
发帖数: 941
42
lumpsum 给你现金
reimbursement是报销
n******e
发帖数: 957
43
lumpsum是什么意思呢?我看还要填啥expense form,上传receipts...
公司叫aires...
t*********h
发帖数: 941
44
lumpsum means you get the cash and can spend it in whatever way
but looks like you will get reimbursed
n******e
发帖数: 957
45
我泪奔哦!!!
我还以为是给钱,这啥情况啊!!
叫你填expense reimbursement form. 尼玛还有这种事??
大家有没有遇到啊,这个外包公司叫aires。
s********u
发帖数: 1109
46
来自主题: JobHunting版 - ebay skype interview面经(4轮)
挖个坟,这个readline的题目,搜了一下,好像应该是这个意思吧:
用一个buffer来存字符流,如果中间有换行,那么将这一行返回成一个字符串输出,但
是这个buffer里面的东西继续保留,下次readline()再输出;
如果一行非常长,那么可能需要用到几次read(),来拼出这个完整的line。
/*Implement a function char* readLine(); which returns single lines from a
buffer.
To read the buffer, you can makes use of a function int read(char* buf, int
len) which fills buf with upto len chars and returns the actual number of
chars filled in. Function readLine can be called as many times as desired.
If there is no valid data or newline ter... 阅读全帖
g*******s
发帖数: 2963
47
来自主题: JobHunting版 - 关于内存重新分配的基础问题。
在只用原始malloc或者new的情况下如果这样用是不是第一次分配的内存就leak了,没
法找回来了?
int *a = new int[10];
a = new int[20];
如果我有一个函数void foo(int **a)要改变a所分配的空间
怎样写才能保证在a已经指向某快内存的时候重新分配而没有leak呢?需要用realloc之
类的函数么?
顺便问下如何最快初始化这种维数不定的2d array?
{ { 1, 2, 3 }, { 4, 5 }, { 2, 4, 6, 8}, { 7, 5, 3, 1} }
s********u
发帖数: 1109
48
这是readline那个题我参照网上的代码写的。比这个要复杂一些,因为一个line的字符
是不确定的。
#define MAX_LEN 4096
int read(char* buf, int len);
char *readLine(){

static bool EOF = false;
char *str = NULL;
int i, size = 0;

static int currentPos = MAX_LEN;

static char* buffer = new char[MAX_LEN];

while(!EOF || currentPos != MAX_LEN ){

// buffer is not empty, handle buffer first
if(currentPos != MAX_LEN){

for(i = currentPos; i < MAX_LEN; i++)
... 阅读全帖
s********u
发帖数: 1109
49
记住你上次的4buff里还剩多少啊。否则每次都要去维护那个buf,realloc么
s********u
发帖数: 1109
50
来自主题: JobHunting版 - 请教一个fb面试问题
老题了吧,不过老要写错,尤其是那个read4写read的更恶心。
#define MAX_LEN 4096
int read(char* buf, int len);
char *readLine(){

static bool EOF = false;
char *str = NULL;
int i, size = 0;

static int currentPos = MAX_LEN;

static char* buffer = new char[MAX_LEN];

while(!EOF || currentPos != MAX_LEN ){

// buffer is not empty, handle buffer first
if(currentPos != MAX_LEN){

for(i = currentPos; i < MAX_LEN; i++)
if( buffer[i] ==... 阅读全帖
首页 上页 1 2 3 4 5 下页 末页 (共5页)