+ 1
Function Insert random
How can I make a random insert to items in the bst tree from (0_99), and the insert is from one to three seconds?
1 Resposta
+ 1
You can use a loop in your main function to generate the random int and push it to your bst insert function as part of that loop. it would look something like this:
for(int i=0; i<10; i++) {
int num = (rand()%99)+1;
insert(root, num);
}
Your insert function prototype declared in your class would be:
void insert(BinNode*&root, int item);