A utility function to print a given linked list
def printList ( ptr ) : NEW_LINE INDENT while ( ptr != None ) : NEW_LINE INDENT print ( ptr . data , end = ' - > ' ) NEW_LINE ptr = ptr . next NEW_LINE DEDENT print ( ' NULL ' ) NEW_LINE DEDENT