时间:2021-07-01 10:21:17 帮助过:14人阅读
root = new Lnode; } function append($v) { $sp =& $this->root; while(! empty($sp)) $sp =& $sp->next; $sp = new Lnode; $sp->data = $v; } function delete($v) { $sp =& $this->root; while(! empty($sp) && $sp->next->data != $v) $sp =& $sp->next; if($sp) $sp->next = $sp->next->next; } } $p = new Lists; $p->append('A'); $p->append('B'); $p->append('C'); print_r($p); $p->delete('B'); print_r($p);