Can you please suggest a faster way to select all leaf nodes for a specified parent node?
The code I have at the moment works correctly when the numbers are small, but when there is 1000 leaf nodes, this selection causes script timeouts.
<script type='text/javascript'>
var tree = {
0: [1, 2, 3, 4],
1: [5, 6],
2: [7],
3: [8],
4: [9]
}