完成链表遍历函数的代码。
def traverseAndPrint(head): currentNode = @(4) while currentNode: print(currentNode.data, end=" -> ") currentNode = currentNode.@(4) print("null")
def traverseAndPrint(head): currentNode = head while currentNode: print(currentNode.data, end=" -> ") currentNode = currentNode.next print("null")