@leo9年前
class Node:
value=0
lchild=None
rchild=None
p=None
def __init__(self):
value=0
lchild=None
rchild=None
p=None
def visit(self):
print self.value
def TreeSearch(root,k):
if root==None or k==root.value:
return root
if k<root.value:
return TreeSearch(root.lchild, k)
else:
return TreeSearch(root.rchild, k)
def IterativeTreeSearch(root,k):
while root!=None and k!=root.value:
if k<root.value:
root=root.lchild
else:
root=root.rchild
return root
def PreOrder(root):
if root:
PreOrder(root.lchild)
print root.value
PreOrder(root.rchild)
def TreeMin(root):
while root.lchild!=None:
root=root.lchild
return root
def TreeMax(root):
while root.rchild!=None:
root=root.rchild
return root
def TreeSuccessor(root):
if root.rchild!=None:
return TreeMin(root.rchild)
y=root.p
while (y!=None and root==y.right):
root=y
y=y.p
return y
def TreeInsert(root,z):
y=None
while root!=None:
y=root
if root.value>z.value:
root=root.lchild
else:
root=root.rchild
z.p=y
if y==None:
root=z
else:
if z.value<y.value:
y.lchild=z
else:
y.rchild=z
def Transplant(root,u,v):
if u.p==None:
root=v
else:
if u==u.p.lchild:
u.p.lchild=v
else:
u.p.lchild=v
if v!=None:
v.p=u.p
v.lchild=u.lchild
v.rchild=u.rchild
if u.lchild!=None:
u.lchild.p=v
if u.rchild!=None:
u.rchild.p=v
A=Node()
B=Node()
C=Node()
D=Node()
E=Node()
F=Node()
A.value=6
B.value=5
C.value=2
D.value=5
E.value=7
F.value=8
A.lchild=B
B.lchild=C
B.rchild=D
A.rchild=E
E.rchild=F
B.p=A
C.p=B
D.p=B
E.p=A
F.p=E
print TreeSearch(A, 7)
print IterativeTreeSearch(A, 7)
print TreeSuccessor(A)
G=Node()
G.value=10
TreeInsert(A, G)
PreOrder(A)
Binary Tree
-
Safari 18
iPhone iOS 18.3.2 -
Google Chrome 135
Android 10 Alright fellas, jilli777’s got some cool slots and stuff. Not gonna lie, lost a bit, but also won some. It’s all about the thrill, right? Give jilli777 a shot if you’re feeling lucky! jilli777
-
Google Chrome 135
Android 10 Yo, check out Arionplay! Solid platform for some chill gaming sessions. Easy to navigate and good selection. I’m hooked! Learn more here: arionplay
-
Google Chrome 135
Android 10 Jilibayapk is a solid betting app. Not laggy at all unlike other apps that Ive tried, and the graphics are sharp! Easily one of the better apps on the market! Download: jilibayapk
-
Firefox 137
Mac OS X 10.15 Yo fam, just discovered y666 and it’s giving off some good vibes. The game selection is solid and I pulled a little something something last night. Worth checking out y666
-
Firefox 137
Mac OS X 10.15 Yo, 1001juegos is the spot for some casual fun. They got a mad selection of free games to kill time with. Perfect for when you’re bored at work, ya know 1001juegos
-
Firefox 137
Mac OS X 10.15 Zombie Outbreak on mmabetr.net is surprisingly addictive! Didn’t expect to be hooked, but the gameplay is solid. Worth a look if you’re bored. zombie outbreak

Gave 11betorg a whirl. It’s… okay. It’s got the basics covered, I guess, but there’s nothing that really makes it stand out. If you’re not too picky, it’s fine. Decide for yourself: 11betorg