mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-22 15:53:50 +08:00
Fixed some problems, indentation and Pointer
This commit is contained in:
@ -7,4 +7,4 @@ import collections
|
||||
from typing import List
|
||||
from .linked_list import ListNode, list_to_linked_list, linked_list_to_list, get_list_node
|
||||
from .binary_tree import TreeNode, list_to_tree, tree_to_list, get_tree_node
|
||||
from .print_util import print_matrix, print_linked_list, print_tree
|
||||
from .print_util import print_matrix, print_linked_list, print_tree, print_dict
|
@ -1,7 +1,7 @@
|
||||
'''
|
||||
File: print_util.py
|
||||
Created Time: 2021-12-11
|
||||
Author: Krahets (krahets@163.com)
|
||||
Author: Krahets (krahets@163.com), msk397 (machangxinq@gmail.com)
|
||||
'''
|
||||
|
||||
import copy
|
||||
@ -72,3 +72,12 @@ def print_tree(root, prev=None, isLeft=False):
|
||||
prev.str = prev_str
|
||||
trunk.str = ' |'
|
||||
print_tree(root.left, trunk, False)
|
||||
|
||||
def print_dict(d):
|
||||
"""Print a dict
|
||||
|
||||
Args:
|
||||
d ([type]): [description]
|
||||
"""
|
||||
for key, value in d.items():
|
||||
print(key, '->', value)
|
Reference in New Issue
Block a user