python實現二叉樹

這裏我用python實現簡單的二叉樹,我實現的樹在插入時會將原來的子樹降低一階node #-*- coding:utf-8 -*- #嵌套實現樹 #以r爲根生成二叉樹 def newTree(r): return [r,[],[]] def getRootVal(r): return r[0] def setRootVal(r,newVal): r[0] = newV
相關文章
相關標籤/搜索