博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【剑指offer】面试题26:复杂链表的复制
阅读量:4068 次
发布时间:2019-05-25

本文共 684 字,大约阅读时间需要 2 分钟。

def copyRandomList(self, head):        if None == head: return None        phead = head        while phead:            pnext = phead.next            phead.next = RandomListNode(phead.label)            phead.next.next = pnext            phead = pnext                    phead = head        while phead:            if phead.random:                phead.next.random = phead.random.next            phead = phead.next.next                    head2 = RandomListNode(-1)        tail2 = head2        phead = head        while phead:            tail2.next = phead.next            phead.next = phead.next.next            phead = phead.next            tail2 = tail2.next        return head2.next

转载地址:http://xumji.baihongyu.com/

你可能感兴趣的文章
rrdtool-1.4.5 compile in rhel6
查看>>
nginx 技巧
查看>>
oracle omf
查看>>
自定义 mrtg 数据
查看>>
rsync , rsync + ssh, rsync + lsyncd 多种同步方案与比较
查看>>
rhel6 网卡定义注意事项
查看>>
ceph 数据恢复检测
查看>>
oracle exp 常见错误 EXP-00091
查看>>
mysql error handler 例
查看>>
mysql 触发器
查看>>
mysql 游标
查看>>
mysql event
查看>>
mysql information_schema 视图信息
查看>>
mysql preformance_schema 翻译
查看>>
rpmbuild 文档
查看>>
rpmbuild 使用笔记
查看>>
openstack 管理三十九 - 通过修改数据库方法实现 VM 迁移
查看>>
shell 限制用户输入条件
查看>>
利用 PHP 查询 ZABBIX API 信息, 获得主机当前使用率
查看>>
正则匹配
查看>>