下面代码遍历并输出一个循环单链表,其中 head 指向链表的第一个节点,横线处应填入的是( )。

kb659211 单选题 共 个子题
class Node:
    def __init__(self, val):
        self.val = val
        self.next = None

def printList(head):
    if head is None:
        return
    p = head
    _______________________
    print()
A
while p is not None:
    print(p.val, end=" ")
    p = p.next
B
while p.next is not None:
    print(p.val, end=" ")
    p = p.next
C
while True:
    print(p.val, end=" ")
    p = p.next
    if p == head:
        break
D
while p:
    print(p.val, end=" ")
    p = p.next
正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧