当前位置: 首页>>代码示例>>Python>>正文


Python ListNode.print_ll方法代码示例

本文整理汇总了Python中ListNode.ListNode.print_ll方法的典型用法代码示例。如果您正苦于以下问题:Python ListNode.print_ll方法的具体用法?Python ListNode.print_ll怎么用?Python ListNode.print_ll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListNode.ListNode的用法示例。


在下文中一共展示了ListNode.print_ll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test1

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test1():
    n1 = ListNode(1)
    n3 = ListNode(3)

    n2 = ListNode(2)
    n4 = ListNode(4)
    n14 = ListNode(14)
    n18 = ListNode(18)

    n7 = ListNode(7)
    n9 = ListNode(9)
    n11 = ListNode(11)
    n13 = ListNode(13)

    n1.next = n3
    l1 = n1

    n2.next = n4
    n4.next = n14
    n14.next = n18
    l2 = n2

    n7.next = n9
    n9.next = n11
    n11.next = n13
    l3 = n7

    lists = [l1, l2, l3]
    rslt = mergeKLL(lists)
    ListNode.print_ll(rslt)
开发者ID:victorfei,项目名称:interview,代码行数:32,代码来源:mergeKSortedList.py

示例2: test3

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test3():
    n1 = ListNode(1)
    n2 = ListNode(2)

    n1.next = n2

    ListNode.print_ll(reorderList(n1))
开发者ID:victorfei,项目名称:interview,代码行数:9,代码来源:reorderList.py

示例3: test3

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test3():
    n1 = ListNode(1)
    n2 = ListNode(2)

    n2.next = n1

    h = n2
    rslt = mergeSort(h)
    ListNode.print_ll(rslt)
开发者ID:victorfei,项目名称:interview,代码行数:11,代码来源:sortList.py

示例4: test3

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test3():
    n6 = ListNode(6)
    n7 = ListNode(7)
    n9 = ListNode(9)

    n5 = ListNode(5)

    n6.next = n7
    n7.next = n9
    ListNode.print_ll(addTwoNumbers(n6, n5, 0))
    ListNode.print_ll(addTwoNumbersNoCarry(n6, n5))
开发者ID:victorfei,项目名称:interview,代码行数:13,代码来源:addTwoNums.py

示例5: test2

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test2():
    n1 = ListNode(1)
    n2 = ListNode(2)
    n3 = ListNode(3)

    n3.next = n2
    n2.next = n1

    h = n3
    rslt = mergeSort(h)
    ListNode.print_ll(rslt)
开发者ID:victorfei,项目名称:interview,代码行数:13,代码来源:sortList.py

示例6: test2

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test2():
    n1 = ListNode(1)
    n2 = ListNode(2)
    n3 = ListNode(3)
    n4 = ListNode(4)

    n1.next = n2
    n2.next = n3
    n3.next = n4

    ListNode.print_ll(reorderList(n1))
开发者ID:victorfei,项目名称:interview,代码行数:13,代码来源:reorderList.py

示例7: test3

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test3():
    n1  = ListNode(1)
    n1a = ListNode(1)
    n1b = ListNode(1)
    n2a  = ListNode(2)
    n2b  = ListNode(2)

    n1.next = n1a
    n1a.next = n1b
    n1b.next = n2a
    n2a.next = n2b

    ListNode.print_ll(removeDupComp(n1))
开发者ID:victorfei,项目名称:interview,代码行数:15,代码来源:removeDuplicatesCompletely.py

示例8: test1

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test1():
    n0 = ListNode(0)
    n1 = ListNode(1)
    n2 = ListNode(2)
    n3 = ListNode(3)
    n4 = ListNode(4)

    n0.next = n1
    n1.next = n2
    n2.next = n3
    n3.next = n4

    ListNode.print_ll(reorderList(n0))
开发者ID:victorfei,项目名称:interview,代码行数:15,代码来源:reorderList.py

示例9: test2

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test2():
    n1  = ListNode(1)
    n1a = ListNode(1)
    n1b = ListNode(1)
    n2  = ListNode(2)
    n3  = ListNode(3)

    n1.next = n1a
    n1a.next = n1b
    n1b.next = n2
    n2.next = n3

    ListNode.print_ll(removeDupComp(n1))
开发者ID:victorfei,项目名称:interview,代码行数:15,代码来源:removeDuplicatesCompletely.py

示例10: test3

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test3():
    n1 = ListNode(1)
    n2 = ListNode(2)
    n3 = ListNode(3)
    n4 = ListNode(4)
    n5 = ListNode(5)
    n6 = ListNode(6)

    n1.next = n2
    n2.next = n3
    n3.next = n4
    n4.next = n5
    n5.next = n6
    ListNode.print_ll(revKGrp(n1, 4))
开发者ID:victorfei,项目名称:interview,代码行数:16,代码来源:reverseInKGrp.py

示例11: test4

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test4():
    l1 = ListNode(1)
    l2 = ListNode(2)
    l3 = ListNode(3)
    l4 = ListNode(4)
    l5 = ListNode(5)

    l1.next = l2
    l2.next = l3
    l3.next = l4
    l4.next = l5

    ListNode.print_ll(l1)
    ListNode.print_ll(removeNtoLast(l1, 2))
开发者ID:victorfei,项目名称:interview,代码行数:16,代码来源:removeNToLast.py

示例12: test1

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test1():
    n1 = ListNode(1)
    n2 = ListNode(2)
    n3 = ListNode(3)
    n4 = ListNode(4)
    n5 = ListNode(5)
    n6 = ListNode(6)

    n1.next = n2
    n2.next = n3
    n3.next = n4
    n4.next = n5
    n5.next = n6
    #ListNode.print_ll(revKGrp(n1, 2))
    ListNode.print_ll(revKGroup_r(n1, 1))
开发者ID:victorfei,项目名称:interview,代码行数:17,代码来源:reverseInKGrp.py

示例13: test2

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test2():
    n1 = ListNode(1)
    n2 = ListNode(2)
    n3 = ListNode(3)
    n4 = ListNode(4)
    n5 = ListNode(5)
    n6 = ListNode(6)

    n1.next = n2
    n2.next = n3
    n3.next = n4
    n4.next = n5
    n5.next = n6
    ListNode.print_ll(n1)
    ListNode.print_ll(rotateLSegment(n1, 1, 4))
开发者ID:victorfei,项目名称:interview,代码行数:17,代码来源:rotateListSegment.py

示例14: test1

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test1():
    n1a = ListNode(1)
    n1b = ListNode(1)
    n1c = ListNode(1)
    n2 = ListNode(2)
    n3a = ListNode(3)
    n3b = ListNode(3)
    n3c = ListNode(3)

    n1a.next = n1b
    n1b.next = n1c
    n1c.next = n2
    n2.next = n3a
    n3a.next = n3b
    n3b.next = n3c
    ListNode.print_ll(removeDup(n1a))
开发者ID:victorfei,项目名称:interview,代码行数:18,代码来源:removeDuplicates.py

示例15: test6

# 需要导入模块: from ListNode import ListNode [as 别名]
# 或者: from ListNode.ListNode import print_ll [as 别名]
def test6():
    n6 = ListNode(6)
    n7 = ListNode(7)
    n9 = ListNode(9)

    n5 = ListNode(5)
    n8 = ListNode(8)
    n4 = ListNode(4)

    n6.next = n7
    n7.next = n9

    n5.next = n8
    n8.next = n4

    ListNode.print_ll(addTwoNumbers(n6, n5, 0))
    ListNode.print_ll(addTwoNumbersNoCarry(n6, n5))
开发者ID:victorfei,项目名称:interview,代码行数:19,代码来源:addTwoNums.py


注:本文中的ListNode.ListNode.print_ll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。