i don't know why but my compiler reads only upto insert statement.
this is what compiler looks like:
nchy@ubuntu:~/Desktop$ g++ tree.cpp
nchy@ubuntu:~/Desktop$ ./a.out
2
insert 0 14 10 85 15 70 20 60 30 50 65 80 90 40 5 55
i want to implement following input format
2
insert 0 5 3 5 8 6 0
select 0 2
first line=> number of operations
second line=>
insert =>insert operation
0=> 0th tree
5=>5 insertions
then 5 numbers to be inserted
third line=>
select=>select operation
0=>0th tree
2=>2nd smallest element thus selecting 2nd smallest element in 0th tree.
this is what i tried to implement above input format.let me know where it went wrong
int no_of_trees,tree_no,no_of_insertions,number,k;
string s;
cin>>no_of_trees;
redblacktree<int> rb[no_of_trees];
getline(cin,s,' ');
for(int i=0;i<no_of_trees;i++)
{
if(s=="insert")
{
cin>>tree_no;
cin>>no_of_insertions;
for(int i=0;i<no_of_insertions;i++)
{
cin>>number;
rb[tree_no].insert(number);
}
}
if(s=="select")
{
cin>>tree_no;
cin>>k;
rb[tree_no].kthsmallest(k);
}
}