摘要: 问题描述 给定两个单链表,链表的每个结点代表一位数,计算两个数的和。例如 :输入链表 (3一>1一> 5)和链表(5一>9一> 2),输出 :8 0 8,即 513+295 =808,注意个位数在链表头。 class Node: def __init__(self, data=None, next= 阅读全文
posted @ 2019-09-04 12:43 上进的小苗同学 阅读(422) 评论(0) 推荐(0)
摘要: 无序链表移除重复项 coding:utf 8 class Node: def __init__(self, data=None, next=None): self.data = data self.next = next def print_link(head): cur = head.next w 阅读全文
posted @ 2019-09-04 12:38 上进的小苗同学 阅读(151) 评论(0) 推荐(0)
摘要: 链表逆序 有头结点的链表逆序 coding:utf 8 有头结点的链表逆序 class Node: def __init__(self, data=None, next=None): self.data = data self.next = next def print_link(head): cu 阅读全文
posted @ 2019-09-04 12:33 上进的小苗同学 阅读(180) 评论(0) 推荐(0)