Miscellaneous Notes (draft)¶
def Treaverse():
# Code to be run
...
Treaverse() # Entry point
# Return point
# The rest code to be run
...
while stack:
current, status = pop()
if status == 0:
# Code to be run
...
# Change the status of current
push(current, 1)
# The next function to be excuted
push(current.next, 0)
# Return point
continue
elif status == 1:
...
class Sentinel:
"""Unique sentinel value."""
_registry = None
def __new__(cls):
if cls._registry is None:
cls._registry = super().__new__(cls)
return cls._registry
def __repr__(self):
return 'Sentinel'
def len(self) -> int:
return self.last + 1
To do list:
Simplify the Sequential List.
Fix
pre_order_traversal()in the Prelusion of Tree.Test Tree. It must be wrong.