How to solve the stack overflow caused by the creation of segment tree by js?

use JavaScript to build a segment tree, and recursion is used in the construction process. This should make the call stack overflow. I wonder if there is any other way to solve this problem.

< H1 > Code < / H1 >
   


judge that there is something wrong with the condition, and do not stop recursion in time


there is a problem in the calculation of the middle value of the left and right boundary, which should be:

let mid = (l + (r - l) / 2) | 0;
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-1e43bcb-4429c.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-1e43bcb-4429c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?