How to get the last child node of the tree structure

I don"t know how to describe the seed nodes, which are those under the child nodes that have no child nodes (what exactly is the node, would you please correct it for me?).

as shown in the figure, the red box marks the child nodes that need to be obtained:

clipboard.png

is there a good way to get it?

Let"s not mention the method of

PS: traversing all nodes and then determining whether the node has children or not. Is there anything more efficient or skillful?


this kind of node is called a leaf node!

  • if it is a sequentially stored complete binary tree, then the second half of the nodes are leaf nodes.
  • if it is an index tree, you can build an index to the leaf node to reduce the number of traverses.
  • if it is an ordinary tree (without any special place), it can only be traversed, and there is no other method
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37562-2adcc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37562-2adcc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?