I have a tree data structure where each node can have any number of children, and the tree can be of any height. What is the optimal way to get all the leaf nodes in the tree? Is it possible to do better than just traversing every path in the tree until I hit the leaf nodes?

In practice the tree will usually have a max depth of 5 or so, and each node in the tree will have around 10 children. 

I'm open to other types of data structures or special trees that would make getting the leaf nodes especially optimal. 

I'm using javascript but really just looking for general recommendations, any language etc.

Thanks!