avatar
b*g
1
全是C++的
1. STL map怎么插入和查找才能让时间复杂度小于O(lg n)?
2. new和malloc后会发生什么?我回答就是分块内存也在前面存着大小
3. foo *p1 = new foo();
foo *p2 = new foo();
如果第一行成功了,第二行产生了exception,那么p1会怎么样?
4. smart pointer怎么用?
5. C++中怎么实现exception handle?
avatar
B*s
2
大家一般都送老师哪个店的?有什么讲究吗?
我要送的是preschool的老师。
avatar
u*o
3
4. smart pointer怎么用?
Reference counting to avoid memory leak.
avatar
b*g
4
我就是这么答得,还按照careercup的例子作了说明,但是他不满意

【在 u*****o 的大作中提到】
: 4. smart pointer怎么用?
: Reference counting to avoid memory leak.

avatar
u*o
5
。。。。那怎么办。。
要不展开讲讲auto_pointer and shared_pointer?
再说说SMART POINTER可能的问题,CYCLIC REFERENCE?

【在 b****g 的大作中提到】
: 我就是这么答得,还按照careercup的例子作了说明,但是他不满意
avatar
r*n
6
1. STL map是用red-black tree实现的吧,怎么查找都是O(log N)吧。插入的话,也是
O(log N),但是有一个overloaded version可以输入一个hint,可能小于O(log N)。
2. new分配内存之后会自动call default constructor,malloc不会。
3. p1就是memory leak吧。
4. 他是不是想问auto_ptr拷贝之后原来的那个就失效了?不过新标准里面auto_ptr已
经被deprecated,还是用shared_ptr, unique_ptr吧。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。