اريد كتابة code لبرنامج أعطيه ال tree ويعطيني فيما اذا كانت
_ balanced binary tree او
_complete (full) tree أو
_ليست اي منهما
انا لدي بعض الافكار لكن لا أستطيع تجميعها بالشكل الصحيح مثلا
depth of tree = max (depth left side , depth right) +1
اي اذا كان depth للleft side اكبر يكون depth للtree =left depth +1
if (tree=null) return 0
left depth =finaldepth =(tree.depth) and
right depth =final depth =tree.right
depth=maxdepth (tree.right)
depth=max(left depth,right depth) +1
return depth
اتمنى أن يكون السؤال واضح واجد مبرمجا محترفا يساعدتي في ربط هذه الفكار وكتابة ال code