关于 lovecreatesbeauty 陈小平主编《数据结构导论》教材打假


所有跟贴·加跟贴·新语丝读书论坛

送交者: BerkeleyWolf 于 2009-07-29, 16:18:41:

(2)进栈
void Push(LStackTp * ls, DataType x)
{
LStackTp * p;
p = (LStackTp * )malloc(sizeof(LStackTp));
p->data = x;
p->next = ls;
ls = p; /* 错误2 */
}

这里根本就没有错误。进栈操作给linked list implemented stack 增加了一个节点,并且栈头指针指向这个新的节点。free 操作需要在 Pop中完成。




所有跟贴:


加跟贴

笔名: 密码: 注册笔名请按这里

标题:

内容: (BBCode使用说明

  • if you guys don't enlighten me, I would have no way to learn it. :) (无内容) - steven (0 bytes) 2009-07-29, 18:33:37 (350846)