由买买提看人间百态

topics

全部话题 - 话题: stack
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
y*********e
发帖数: 518
1
/* create a stack
* returns NULL if failure to create.
*/
STACK* stack_create();
/* dispose a stack */
void stack_close(STACK* stack);
/* push the data into a stack. returns 0 if fail. */
int stack_push(STACK* stack, void* data);
/* pop the top item from the stack and store it into data.
returns 0 if fail. */
int stack_pop(STACK* stack, void** data);
/* get number of items in the stack */
int stack_size(STACK* stack);
y*********e
发帖数: 518
2
嗯,这个要看面试的时候沟通弄清楚要求了。
若是要存实实在在的data,那么大抵可以在stack_create的时候引入一个参数
,是为每一个元素的size。在push的时候,把数据拷贝到stack上。
typedef struct {
size_t count; /* no of elements in stack */
size_t capacity; /* max no of elements can be held */
size_t element_size; /* size of each element */
char* ptr;
} STACK;
/* Create a stack by specifying size of each element.
returns NULL if failure. */
STACK* stack_create(size_t element_size) {
STACK* s = malloc(sizeof(STACK));
if (!s) retur... 阅读全帖
w*******y
发帖数: 60932
3
I have been looking at the Ariat boots for my kids. I noticed today it
listed
Buy from Amazon.com:
* Save $20 on select $80 orders of qualifying kids' shoes offered by
Amazon.com. Here's how (restriction s apply)
* Save $20 on $80 orders of qualifying kids' boots offered by Amazon.com
. Here's how (restriction s apply)
When I checked out both discounts applied. Making the $85 boots come out to
$45.
Once I started looking, it also was working on some kids rain boots & some
lace up boo... 阅读全帖
c*******r
发帖数: 309
4
public void preOrderTraversal(Node root){
if(root==null)
return null;
Stack stack=new Stack();
stack.push(root);
while(!stack.isEmpty()){
Node temp=stack.pop();
System.out.println(temp.val);
if(temp.left!=null)
stack.push(temp.left);
if(temp.right!=null)
stack.push(temp.right);
}
}
比较麻烦的是inOrderTraversal. 需要写一个pushLeft的方法
s****j
发帖数: 67
5
粗略想法:
再开一个stack
while (!stack.empty()) {
Node current=stack.top();
stack.pop();
//color current to grey
current->pos=stack.size(); // anyway, record current stack size
stack2.push(current);
//push all edge
while (!stack2.empty() && stack2.top()->pos==stack.size()) {
Node t=stack2.top();
//color t to black
stack2.pop();
}
}
w***g
发帖数: 5958
6
上次搞DPDK还是几年前,恍若隔世啊。 我记得上次看的时候唯一能用的user-space
stack是seastar。 据说f-stack性能不如seastar,但是在公网环境下稳定性更好。
差别应该在于seastar是custom stack,f-stack用的是freebsd的stack。
刚刚看了一眼,DPDK自己的TCP/IP stack好像也起来了。
这货应该没啥threading model。就是一个core上pin一个process,
每个process配置好以后跑一个event loop。然后有状态后触发
callback。callback里面是一个用巨大的switch实现的状态机。
扫了一眼范例感觉就是这样,没仔细看。
我觉得用10GB以太网配上DPDK来做deep learning训练的
parameter server或许能卖钱, 如果能做出来的话。
T********i
发帖数: 2416
7
根据我对有限文档的理解,根本不是你说的那回事。
这货有一个primary process。就是busy polling。实现一个bsd的socket栈。
你的程序是另外一个process。要link它那个socket库。Api都改名了。你这个process
的socket操作要通过primary。通信是shared memory。
貌似他们保留了huge page内存。给dpdk和他们自己的框架使用。我一般用huge page保
留我自己的numa memory pool。被他们用了,我自己就用不着了。


: 上次搞DPDK还是几年前,恍若隔世啊。 我记得上次看的时候唯一能用的user-
space

: stack是seastar。 据说f-stack性能不如seastar,但是在公网环境下稳定性更
好。

: 差别应该在于seastar是custom stack,f-stack用的是freebsd的stack。

: 刚刚看了一眼,DPDK自己的TCP/IP stack好像也起来了。

: 这货应该没啥threading model。就是一个core... 阅读全帖
h******g
发帖数: 600
8
如果是face to face pi stacking, 一般是不是用centroid to centroid距离来衡量,
这个距离范围是多少?
如果是displaced face to face stacking, centroid to centroid距离一般是多少? 4.2 Å
是不是太远了。
还有edge to face pi stacking 的 H 到 环 centroid的距离范围一般是多少?3.0 Å;
是不是太远。看了一些参考资料,都没有给出明确的答案。哪位高手指点一下
,谢谢了。
还有一个问题,如果是两个苯环在一起形成pi pi stacking,是有功电子基团俩苯环之间
pi pi stacking 作用强,还是连有两个吸电子基团的俩苯环之间的pi pi stacking作用强?
这个看到有个文献讲,吸电子的强,因为电子云密度低,降低了pi electron repulsion,
我不太明白,难道pi pi stacking不需要pi电子云密度高吗?
请指教,谢谢了。
w*******y
发帖数: 60932
9
Melissa & Doug Stacking Train Solid wood. $8.21 free shipping with Prime (
FSSS) from Amazon
This brightly-colored wooden train is over 17" long and includes 15
interchangeable pieces to get any child's imagination rolling. The solidly-
built engine and multicolored freight cars have sturdy pegs for linking the
cars and stacking the "cargo" blocks. Get on board for a high-quality, value
-packed adventure.Made of solid wood
Comes with interchangeable pieces
For ages 2 and above
Melissa & Doug Sta... 阅读全帖
E****h
发帖数: 41
10
【 以下文字转载自 JobHunting 讨论区 】
发信人: Elijah (十), 信区: JobHunting
标 题: hiring in bay area: front end, full stack, data engineer
发信站: BBS 未名空间站 (Thu Apr 7 12:41:20 2016, 美东)
请斑竹们别再删帖了,我们收到一些简历,大都开始安排面试。既然是供需双方共赢的
事情,请版主们刀下留情。谢谢!
湾区公司招聘多个职位,简历请发送到[email protected]/* */
------------------------
Frontend Engineer
The big data team in Huami's US office, is looking for experienced front end
engineer to build state of art virtualization for data.
Responsibilities:
Build the first version of a customer... 阅读全帖
A*******e
发帖数: 12486
11
来自主题: Detective版 - Joe Stack应该算一义士吧
【 以下文字转载自 Military 讨论区 】
发信人: Starbugs (星巴哥), 信区: Military
标 题: Joe Stack应该算一义士吧
发信站: BBS 未名空间站 (Thu Feb 18 22:49:31 2010, 美东)
Joe Stack这事应该算官逼民反,逼上梁山,为了共产主义理想赴汤蹈火吧。人家可不
是瞎胡闹,讨伐檄文中对资本主义的本质有着清醒地认识,瞧人家最后那两句总结得多
精辟。该同志绝对算一反资义士,这里的小将老将怎么也没人出头替他讨个说法,这事
要是发生在中国,估计美国国会会通过一个Joe Stack法案强烈谴责社会主义的邪恶。
所以我觉得中国也应该发个声明或发篇喉舌报社论悼念一下:伟大的共产主义战士,
Joe Stack同志,怀着对共产主义的坚定信念和对资本主义社会人吃人的无比憎恶,为
了揭露美帝国主义的虚伪贪婪和无耻,决定赴汤蹈火,舍身取义,于2月18日驾机起
义,与资本主义的代理人IRS同归于尽,终年54岁。伟大的Joe Stack同志永垂不朽!
j**l
发帖数: 2911
12
来自主题: JobHunting版 - 白板代码,支持O(1)时间GetMin的stack
写一个stack, Push, Pop和GetMin都是O(1)时间
如果在白板上写出如下的代码,能达到面试官的基本要求么?
#define MAX_STACK_SIZE 1000
class Stack
{
int Data[MAX_STACK_SIZE];
int Link[MAX_STACK_SIZE];
int top;
public:
Stack() { top = -1; }
void Push(int x);
int Pop();
int GetMin();
};
void Stack::Push(int x)
{
if ((top + 1) == MAX_STACK_SIZE)
{
printf("Push failed, the stack is full.\n");
return;
}
int min_link = 0;
if (top > -1)
{
min_link = Link[top];
if
y**i
发帖数: 1112
13
来自主题: JobHunting版 - 白板代码,支持O(1)时间GetMin的stack
贴一个我的,正好前几天也写了一个:
template
class Stack
{
T* val;
T* min;
int max_size;
int top;
public:
class Underflow { };
class Overflow { };
Stack() : max_size(1000), top(0) { val = new int[max_size]; min = new
int[max_size]; }
Stack(int s) : max_size(s), top(0) { val = new int[max_size]; min = new
int[max_size]; }
~Stack() { delete[] val; delete[] min; }
void Push(T t);
T Pop();
T GetMin();
};
template void Stack::Push(T t)
{
if (top
f*********5
发帖数: 576
14
来自主题: JobHunting版 - 这个用stack实现queue
stack实现queue的话,可以从push stack一次pop出数个item,放入pop stack。
然后连续对pop stack进行操作即可。。
queue实现stack的话,每次都要用一个queue开始的数个元素pop 出,放入另一个queue,
从而得到queue尾的item,取下一个的时候,又要折腾一遍。。
d****n
发帖数: 1637
15
来自主题: JobHunting版 - heap&stack Linux vs. Windows  (转载)
thanks for you advice.
I just add a function in main()
print a local variable from fun()
Something like this.
void fun(){int a; cout<<&a< main(){
fun();
}
###win32
0035119A
STACK &before=002BF998
HEAP *p=005D83E0
&objA.a002BF988
&objA.b002BF98C
objA=002BF988
STACK &after=002BF970
&a=002BF890 //local variable from fun()
###x64
000000013FB41000
STACK &before=00000000001BF798
HEAP *p=00000000005B67A0
&objA.a00000000001BF7A8
&objA.b00000000001BF7AC
objA=00000000001BF7A8
STACK &after=000000... 阅读全帖
E****h
发帖数: 41
16
来自主题: JobHunting版 - opening: front end, full stack, big data
多个职位open,全新项目和团队,有职业发展空间。prefer 3-5+以上工作经验。简历
请发送[email protected]/* */,谢谢大家!
更多职位:
https://angel.co/huami/jobs
-----------
Frontend Engineer
The big data team in Huami's US office, is looking for experienced front end
engineer to build state of art virtualization for data.
Responsibilities:
Build the first version of a customer facing web UI, support both mobile and
pc. Working closely with backend engineers to define the interface of
services, and UX to keep improving user experience.
Re... 阅读全帖
E****h
发帖数: 41
17
请斑竹们别再删帖了,我们收到一些简历,大都开始安排面试。既然是供需双方共赢的
事情,请版主们刀下留情。谢谢!
湾区公司招聘多个职位,简历请发送到[email protected]/* */
------------------------
Frontend Engineer
The big data team in Huami's US office, is looking for experienced front end
engineer to build state of art virtualization for data.
Responsibilities:
Build the first version of a customer facing web UI, support both mobile and
pc. Working closely with backend engineers to define the interface of
services, and UX to keep improving user experience.
Requir... 阅读全帖
T*********k
发帖数: 1621
18
我老老实实的说,打 NL 1-2 从来没有过,最大 stack 1200。
打 NL 2/5 的话,也只有两次,一次是第一次玩 2/5,是牌运最好的一次,从 200 打
到 2600. 那 stack 要用 5 个 rack 装,还有一次是 down 1600 后,绝地大反攻过一
次,stack 超过两千,其余没有了。
以后大多 stack 到 1000 就 hit and run 了,去年下班年哥年纪大了,就更 WS 了,
赢个 200-300 就 hit and run 了。
不怕 boost 版花的 ego, 这么大的 stack,俺多少时间都没拥有过了。 忆甜思苦,
现在哥连牌都没得打,苍蝇的眼泪都忍不住的扑扑往下流。。。
u****u
发帖数: 229
19
好象现在看到的C编译器都把变量放在stack上,把动态内存放在heap上。比如:
foo() {
int a,b[100];
int *pa;
pa = new int[200];
}
a,b[100],pa都是在stack上的变量,pa指向一块在heap上的内存。特别是b[100],是存在
stack上的100个int大小的内存块。
我的问题是,是不是C规定函数的变量“必须”放在stack上?比如,可以不可以有一个编
译器,把b[100]解释成一个存在stack上的int *, 指向一个heap上100个int大小的内存块
(当然,这块内存的分配,释放由编译器实现)。
这样的一个C/C++编译器会不会违反C的什么规定?可以不可以做这么一个compiler?请高
手详细解释一下吧。谢谢。
f**y
发帖数: 138
20
来自主题: Programming版 - stack trace
I know for x86 or IA64, BP[1] is the return address, BP[0] is the BP after
return. So we can print a stack trace with a do while loop.
How about a MIPS processor? It uses S8 & SP two registers to manage the
stack. Return address & previous stack pointer are stored in the stack with
offsets hard coded. Anybody knows a easy way to print the stack trace for a
MIPS processor? Thanks.
a*****t
发帖数: 30
21
来自主题: Programming版 - 关于thread的stack
cs:app上这么描述的:
The memory model for the separate thread stacks is not as clean. These
stacks are contained in the stack area of the virtual address space, and are
usually accessed independently by their respective threads.
按这个说法,thread的stack是分配在 virtual memory的stack区域。
但是这样如何管理呢? 当一个thread退出后, 如果释放它的thread堆栈, 是不是就
在全局的堆栈区域里产生了一片空白区域? (因为线程的退出肯定不是按照他们建立顺序的逆序进行的。)
这点让我很不理解。
有没有什么资料能详细讲这些的? 多谢
a*****t
发帖数: 30
22
来自主题: Programming版 - 关于thread的stack
Thanks a lot. At first I thought that the "stack area" was the stack of the
process. And each thread use a part of the "stack area" as its local stack.
And this made me very confused.
I think it makes more sense that each thread is allocated with a signle "
stack area", which probably comes from the heap of the process. Am I right?
w*******y
发帖数: 60932
23
Amazon has two discounts available on select kids shoes - 25% year end sale
and 20% when you buy two select kids shoes. You must click on each pair of
shoes and scroll down to see "Special Offers and Promotions" to see if the
shoes qualify for both discounts. Discounts stack for 45% off at checkout
when you buy 2 pairs.
Girls 25% off shoes:
http://www.amazon.com/gp/search/ref=sr_nr_n_3?rh=n:672123011,p_6:ATVPDKIKX0DER,p_83:P1NA3QT0UFVNUDPAEP,n:!672124011,n:679217011&bbn=672124011&ie=UTF8&qid=129... 阅读全帖
w*******y
发帖数: 60932
24
Kohls have 2 codes running today that stack on apparel for kids-toddlers &
baby
Use code KIDS20 first for 20% off then
Use code XTRA15 for 15% off
99c shipping per item
Here are some things I found
Jumping Beans Bling Babydoll Top 2T-4T:
http://www.kohls.com/kohlsStore/clearance/kids1/toddlergirls/PR Beans Bling Babydoll Top.jsp
- $3.54 + 99c
Jumping Beans Bling Babydoll Top 4 - 7:
http://www.kohls.com/kohlsStore/clearance/kids1/girls46x/PRD~72 Beans Bling Babydoll Top.jsp#
#" rel="nofollow" t... 阅读全帖
h*******e
发帖数: 1377
25
我在看cracking code interview阿,第三章
实现三个函数,o(1)push pop min
第一次做 没考虑太多 堆栈为空的情况。。
就是开个int数组, 然后 push pop 之后 时候 顺便计算 min
但是后来 发现我第一次写 newPop的时候
我写的函数类似
int newPop() { return arr[pos--];}
这样的函数 不规范 没考虑为空的情况
第二次又思考的时候 发现 和书上实现 java stack
不同的是.. C++/C 返回类型 如果是int 的话。。
无法判断stack 为空, 因为 没有一个类似NULL的
特殊value来 表明这个堆栈是空。。
莫非 函数是
int pop(){ if(!isEmpty()) return arr[pos --]; else;}
else 后面 为空。。。什么都不作 还是 返回异常 还是怎样阿? 还是这种 很基础
的stack 实现也必须要调用 c++ stl 的 stack来完成才标准阿。。
d****n
发帖数: 1637
26
来自主题: JobHunting版 - heap&stack Linux vs. Windows  (转载)
//in windows
#include
#include
using namespace std;
class A{
public :
int a;
int b;
};
int main()
{
cout<<&main<

int before=4;
cout<<"STACK &before="<<&before< A objA;
void *p=malloc(1000);
cout<<"HEAP *p="< cout<<"&objA.a"<<&(objA.a)< cout<<"&objA.b"<<&(objA.b)< cout<<"objA="<<&objA< int after=4;
cout<<"STACK &after="<<&after< return 0;
}
//output from windows wi... 阅读全帖
h*d
发帖数: 19309
27
你自己扯的你都不记得了? cql那货返回点数据也就罢了,处理数据还是算了。

http://www.mitbbs.com/article_t/JobHunting/33063511.html
发信人: zhaoce (米高蜥蜴), 信区: JobHunting
标 题: Re: full stack track 和 backend track 哪个更有前途?
发信站: BBS 未名空间站 (Thu Oct 1 07:59:32 2015, 美东)
如果是backend的话
java -> tomcat/jdbc/db(sql) -> spring/hibernate -> nosql/spark/flink/lucene
-> vert.x/netty/core java
差不多酱紫,虽然最后一步比倒数第二步数学要容易点,但是更迟出来
所以如果是学习的话,那就把最后两个颠倒一下
到了spark之后,就明显感觉数学要求陡然升高,高等数学就开始来了
第一步就是线性代数
一般的web也就是到tomcat这个level吧
很多full stack其实就是front end
无非php ->... 阅读全帖
z****e
发帖数: 54598
28

full stack一般都默认是front end
懂backend的一般都不愿意强调自己懂html, css, js这些东西
因为这些工作本质上不过是ui
所以很多人为了不被误认为是front end
都不说自己是full stack
真要full stack,几乎每一个backend都是full stack
谁没写过点js呢?
m********u
发帖数: 3942
29
【 以下文字转载自 Seattle 讨论区 】
发信人: missingyou (miss), 信区: Seattle
标 题: Senior Full Stack Engineer -- long term contractor职位
发信站: BBS 未名空间站 (Wed Jun 28 15:01:54 2017, 美东)
有兴趣请站内或者邮件 [email protected]
Our client is is looking for talented Senior Full Stack Software Development
Engineers for supporting product development and advanced R&D innovations
of services in the cloud.
The lab urgently needs senior full stack software development engineers who
are passionate about state-of-art big data platf... 阅读全帖
p*******p
发帖数: 13670
30
来自主题: TexasHoldem版 - 被人stack off,求指点
deep stack怎么可能唬住short stack, relative stack size是短的一方决定的,
short stack对deep, short有优势
W********m
发帖数: 7793
31
来自主题: TexasHoldem版 - Spew master vs short stack.
Probably should not be squeezing with Q6o when short stack fish is involved.
I am at bb with Q6o.
CO raise 3$. short stack button calls 3$.
I raise to 13$ with Q6o. CO folds button calls.
flop 953 Rainbow. Pot is 29$ button has 25$ left.
My hand is too good to pass with so many back door straights! en.. so i
shove..
Button tank until 1 sec left and called AsJs.. haha.. i did not suck out..
Been burned too many times recently by short stack fish. Need to squeeze
with better hand next time when ... 阅读全帖
q****8
发帖数: 3281
32
来自主题: TexasHoldem版 - how to trap short stack with big pairs
一桌的short stacks:
600NL 6max
SB $174, short stack reg
BB $137, short stack reg
UTG $189, bad semi reg
UTG+1 $171, short stack reg
CO $216, no idea
BTN $821 (Hero), with JJ
Preflop
UTG opens to $12
Hero calls $12
BB shove $131
UTG folds
Hero calls
BB shows 22
s*******y
发帖数: 851
33
You can write a OS-less TCP/IP stack and web server. But it won't fit for
every hardware. You have to write different stack for different platform. I
had written an OS-less TCP/IP stack for PC using assembly. You can put a
simple socket program on a floppy disk and run it on a pc without a
harddrive. After I graduated they have written a web server and a mail
server on top of that TCP/IP stack. But it is specific for PC and a 3com nic
. I don't think they are published for free. So you have to
f*******8
发帖数: 3612
34
来自主题: EmergingNetworking版 - 关于switch stack,3750
好像有些公司用3750 stack, 我看了一下,没领会这个结构到底有什么应用上的不可或
缺的优点。
1 能理解它在管理上有单一的IP等等,所以好管理,但这个特点,只要switch不是太多
,不用stack也可以。
2. 从end user(就是每个port接的用户)角度来讲,你switch是stack起来也好,是其他
方法连接起来也好,只要能连起来,特性有什么差别么?
3. 用vtp不是也可以集中配置么?
stack 有什么不可替代的地方么?
--------------
人生还能怎么样?人生就是一连串的现象,所有现象,无非所见。
Be Careful what you wish for; it may come true.
t****t
发帖数: 6806
35
来自主题: Programming版 - how to use stack(s) to realize a queque
一个明显的改进是这样, 每次朝stack A里push (push stack).
pop时,从stack B (pop stack) pop. 如果pop时遇到B为空,则把A搬到B.
这样平均复杂度还是O(1). 不过不能保证每个操作都是O(1).

action
w****o
发帖数: 2260
36
【 以下文字转载自 JobHunting 讨论区 】
发信人: winhao (勇敢的人), 信区: JobHunting
标 题: 问一下STL里的queue, and stack 遍历的问题
发信站: BBS 未名空间站 (Sun Mar 4 02:36:31 2012, 美东)
好像std里queue 和stack的实现没有提供iterator,怎么遍历呢?就是说怎么查看queue
,stack里的elements?
感觉没法弄。比如queue,除非把queue给弄散了,一个一个的 front(), pop(),来查看
里面的东西,可是这样的话,queue就给破坏了。
stack也有同样的问题。
谁给说说有什么好的方法?难道要自己新创造一个实现?
谢谢!
t****t
发帖数: 6806
37
why do you want to use queue/stack in the first place, if you don't need a
queue or stack?
in other words, queue and stack are supposed to visited FIFO or LIFO. if you
want iterator, use deque or vector; they have all the functions of queue or
stack, while having iterators.

queue
c******o
发帖数: 1277
38
first we need to ask why we have heap and stack, obviously you can implement
one using the other.
they just different, and stack is faster mostly if you are ok with its cons
copy from else where:
Stack
very fast access
don't have to explicitly de-allocate variables
space is managed efficiently by CPU, memory will not become fragmented
local variables only
limit on stack size (OS-dependent)
variables cannot be resized
Heap
variables can be accessed globally
no limit on memory size
(relatively) sl... 阅读全帖
w*******y
发帖数: 60932
39
Learning Resources Stack and Count Layer Cake $6.99 free shipping with Prime
(FSSS) from Amazon
Link:
http://www.amazon.com/Learning-Resources-Stack-Count-Layer/dp/B
Google Prices
Link:
http://www.google.com/products/catalog?client=safari&rls=en&q=L Resources Stack and Count Layer Cake&oe=UTF-8&um=1&ie=UTF-8&cid=14973633914476266487&ei=vYc5TbmRH5HAgQe3gbmNCQ&sa=X&oi=product_catalog_result&ct=result&resnum=3&ved=0CC4Q8wIwAg#ps-sellers
#ps-sellers" rel="nofollow" target="_blank" onclick="_gaq.push... 阅读全帖
w*******y
发帖数: 60932
40
Click Here first to activate the 5% off
Suncast 18 Gallon Storage Trends Stacking Bin:
http://www.sears.com/shc/s/p_10153_12605_00968231000P
- $9.99
You get ONLINE ONLY! 20% OFF REGULAR PRICE on select Garage Storage items
Sold by Sears! Discount in cart. Offer ends 31-Jul-2011
Select Pick up in store to save on shipping or ships free w/ShipVantage
Final Price - $7.59 Each
Capacity: 18 gallons (each bin)
Easy access front flap.
Ideal for recycling or dry storage
For use both indoor and out... 阅读全帖
w*******y
发帖数: 60932
41
You get 20% off and Free Ship on Womens Clothing (does NOT work on clearance
) at Target today.
Also code TGTTUY28 and TGT75HFN for additional discounts ***YOU NEED TO BE
LOGGED IN FOR IT TO APPLY*** Asylum!! (coupon may die at any time)
This pair of $15 jeans:
http://www.target.com/p/Mossimo-Supply-Co-Juniors-Bootcut-Jean-
takes off $10 on any other womens clothing item. I would probably
recommend sizing up, as junior fit is not as hippy as womens fit.
This pair of $15 jeans:
http://www.targ... 阅读全帖
e*******r
发帖数: 481
42
来自主题: ChinaNews版 - Joe Stack is a Hero (转载)
【 以下文字转载自 Military 讨论区 】
发信人: exploiter (exploiter), 信区: Military
标 题: Joe Stack is a Hero
发信站: BBS 未名空间站 (Thu Feb 18 22:49:45 2010, 美东)
不管任何形式的组织以任何名义put a shit on your head 的时候,
作为一个男人要做的就是put the shit right back。Joe Stack
作为一个英雄的意义就在这里。在中国Joe stack式的英雄就是杨佳。
可惜这样的人不是太多而是太少了,更多都是那些娘娘腔。整天
想得是怎么把这个shit吃下去吃的更好,而且还争取有机会再拉出
来让别人吃下去。
A*******e
发帖数: 12486
43
来自主题: Detective版 - Joe Stack is a Hero
【 以下文字转载自 Military 讨论区 】
发信人: exploiter (exploiter), 信区: Military
标 题: Joe Stack is a Hero
发信站: BBS 未名空间站 (Thu Feb 18 22:49:45 2010, 美东)
不管任何形式的组织以任何名义put a shit on your head 的时候,
作为一个男人要做的就是put the shit right back。Joe Stack
作为一个英雄的意义就在这里。在中国Joe stack式的英雄就是杨佳。
可惜这样的人不是太多而是太少了,更多都是那些娘娘腔。整天
想得是怎么把这个shit吃下去吃的更好,而且还争取有机会再拉出
来让别人吃下去。
t******h
发帖数: 120
44

比如
int stack_push(STACK* stack, void* data, int size)
size是你要push的数据类型的大小,就是在内存里用多长的地址来表示。
再举个例子 你想要push一个int 就是
stack_push(stack, data, sizeof(int));
这样就知道这个void* 按一个int的长度来处理
建议你去看看youtube里面stanford大学的教程 Programming Paradigms
没记错里面的前10讲就是讲这方面 讲的很详细
l*******y
发帖数: 1498
45
你这样存的是指针,不是data。如果data在stack之外被free了或者被overwrite了,这
个stack存的指针就没用了。
真正的stack还是要存实际数据的吧。

的,
l********y
发帖数: 1327
46
someone said stack memory can also be dynamically allocated. yes stack the
stack memory,not heap.
is this possible? and how?
y*******g
发帖数: 6599
47
给个code?
哪什么时候pop啊?
一般的写法是
while(!stack.empty()) {
Node current = stack.top();
stack.pop();
//push all edge
}
但pop之后就没法在访问了吧
w****o
发帖数: 2260
48
好像std里queue 和stack的实现没有提供iterator,怎么遍历呢?就是说怎么查看queue
,stack里的elements?
感觉没法弄。比如queue,除非把queue给弄散了,一个一个的 front(), pop(),来查看
里面的东西,可是这样的话,queue就给破坏了。
stack也有同样的问题。
谁给说说有什么好的方法?难道要自己新创造一个实现?
谢谢!
i*********7
发帖数: 348
49
if(!stack.empty())
stack.pop()
不知道楼主想要的是不是这个?
因为如果在C++里面,stack是空的还进行pop或者top操作的话,程序会崩溃。
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)