When i insert data like that i get Maximum call stack size error. for(var i=0;i<10000;i++) { MyTree.insert(i,"Data"+i); }