+ 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?

15th Apr 2020, 6:01 PM
Oday S Manasrah
Oday S Manasrah - avatar
1 ответ
+ 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);
15th Apr 2020, 7:26 PM
Elizabeth Kelly
Elizabeth Kelly - avatar