由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 还有两个题。
相关主题
CareerCup questionExtension problem of finding intersection of two sorted array
一个stack怎么sort问一道老题
请教两道算法题CS intern面试经验
用C设计Stack的interface,要求支持各种数据类型。找2个sorted array中的第K小的元素,有O(lgn)方法吗?
一道刚面的算法题问一个amazon的数组排序题
一道面试题问个算法题8
也问两个算法题re: 面试归来,上面经回馈各位战友
一个小公司面经问一个merge k sorted array的问题
相关话题的讨论汇总
话题: stack话题: pop话题: push话题: array话题: element
进入JobHunting版参与讨论
1 (共1页)
b*******d
发帖数: 750
1
1.
写一个stack。
api是:
Stack pop();
Stack push(int value);
int top();
s2 = s1.pop();
那么s2是个独立的stack,但其值等于s1的常规pop之后的结果。s1 pop之后,仍保持原
来的内容,只产生一个新stack。
优化pop 和 push。
这个题我答的不好。有会的告诉哥一下。
2. 两个sorted array,A和B,找其中值。证明复杂度。
l*****a
发帖数: 14598
2
你多大?嫩没礼貌呢?

【在 b*******d 的大作中提到】
: 1.
: 写一个stack。
: api是:
: Stack pop();
: Stack push(int value);
: int top();
: s2 = s1.pop();
: 那么s2是个独立的stack,但其值等于s1的常规pop之后的结果。s1 pop之后,仍保持原
: 来的内容,只产生一个新stack。
: 优化pop 和 push。

l*****a
发帖数: 14598
3
看起来像是用singly linked list 实现stack
成不?

【在 b*******d 的大作中提到】
: 1.
: 写一个stack。
: api是:
: Stack pop();
: Stack push(int value);
: int top();
: s2 = s1.pop();
: 那么s2是个独立的stack,但其值等于s1的常规pop之后的结果。s1 pop之后,仍保持原
: 来的内容,只产生一个新stack。
: 优化pop 和 push。

b*******d
发帖数: 750
4

ok,
"这个题我答的不好。有会的告诉哥一下。" ---->有会的告诉我一下。

【在 l*****a 的大作中提到】
: 你多大?嫩没礼貌呢?
l****c
发帖数: 782
5
都拿到大offer了,有资本傲一下,haha~

【在 b*******d 的大作中提到】
:
: ok,
: "这个题我答的不好。有会的告诉哥一下。" ---->有会的告诉我一下。

c*****n
发帖数: 96
6
I guess we can use copy-on-write (copy-on-push) technology. Each stack keep
a pointer of the top element and shares the same array(the internal element
container) among stacks(generated by pop()), and only create a private
array when the first push is called.

【在 b*******d 的大作中提到】
: 1.
: 写一个stack。
: api是:
: Stack pop();
: Stack push(int value);
: int top();
: s2 = s1.pop();
: 那么s2是个独立的stack,但其值等于s1的常规pop之后的结果。s1 pop之后,仍保持原
: 来的内容,只产生一个新stack。
: 优化pop 和 push。

l****c
发帖数: 782
7
do you think the size of array is a problem?

keep
element

【在 c*****n 的大作中提到】
: I guess we can use copy-on-write (copy-on-push) technology. Each stack keep
: a pointer of the top element and shares the same array(the internal element
: container) among stacks(generated by pop()), and only create a private
: array when the first push is called.

l****c
发帖数: 782
8
two sorted array那题,lz用什么方法解的呢?这题看的很眼熟啊。
l*****a
发帖数: 559
9
Copy-on-write does not optimize push()/pop() operation.
Its main purpose is to save space.

keep
element

【在 c*****n 的大作中提到】
: I guess we can use copy-on-write (copy-on-push) technology. Each stack keep
: a pointer of the top element and shares the same array(the internal element
: container) among stacks(generated by pop()), and only create a private
: array when the first push is called.

c*****n
发帖数: 96
10
Then what's the definition of optimization ? Thanks.

【在 l*****a 的大作中提到】
: Copy-on-write does not optimize push()/pop() operation.
: Its main purpose is to save space.
:
: keep
: element

l*****a
发帖数: 559
1 (共1页)
进入JobHunting版参与讨论
相关主题
问一个merge k sorted array的问题一道刚面的算法题
150上9.10sort stack of boxes的复杂度一道面试题
一个找duplicate element in an array的问题也问两个算法题
这个题目有什么trick一个小公司面经
CareerCup questionExtension problem of finding intersection of two sorted array
一个stack怎么sort问一道老题
请教两道算法题CS intern面试经验
用C设计Stack的interface,要求支持各种数据类型。找2个sorted array中的第K小的元素,有O(lgn)方法吗?
相关话题的讨论汇总
话题: stack话题: pop话题: push话题: array话题: element