本文整理汇总了Python中Node.Node.printList方法的典型用法代码示例。如果您正苦于以下问题:Python Node.printList方法的具体用法?Python Node.printList怎么用?Python Node.printList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node.Node
的用法示例。
在下文中一共展示了Node.printList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Node
# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import printList [as 别名]
#############################################
node1 = Node(2, None)
node2 = Node(6, node1)
node3 = Node(4, node2)
node4 = Node(5, node3)
node5 = Node(3, node4)
node6 = Node(2, node5)
node7 = Node(1, node6)
node8 = Node(1, node7)
node9 = Node(5, node8)
head = Node(4, node9)
print("########## Test 1 ###############")
head.printList()
RemoveDuplicates(head)
print('\nList after removing duplicates is :')
head.printList()
#############################################
node1 = Node(2, None)
node2 = Node(6, node1)
node3 = Node(4, node2)
node4 = Node(5, node3)
node5 = Node(3, node4)
node6 = Node(2, node5)
node7 = Node(1, node6)
node8 = Node(1, node7)
node9 = Node(5, node8)
head = Node(4, node9)
示例2: Node
# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import printList [as 别名]
return head
#############################################
node1 = Node(1, None)
node2 = Node(5, node1)
head1 = Node(4, node2)
node3 = Node(9, None)
node4 = Node(9, node3)
head2 = Node(9, node4)
print("########## Test 1 ###############")
head1.printList()
print("\n")
head2.printList()
newhead = Add(head1, head2)
print("\n")
newhead.printList()
node1 = Node(9, None)
node2 = Node(7, node1)
head1 = Node(3, node2)
node3 = Node(9, None)
node4 = Node(9, node3)
node5 = Node(5, node4)
head2 = Node(9, node5)