Total number of nodes in a tree data structure?

后端 未结 6 613
无人共我
无人共我 2021-01-31 05:38

I have a tree data structure that is L levels deep each node has about N nodes. I want to work-out the total number of nodes in the tree. To do this (I think) I

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 06:06

    If you know nothing else but the depth of the tree then your only option for working out the total size is to go through and count them.

提交回复
热议问题