0% found this document useful (0 votes)
3 views

Code Assessment 3

Uploaded by

sociallyletsmeet
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Code Assessment 3

Uploaded by

sociallyletsmeet
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

{

break;
}
}
i++;
}

//////////////////////////////////////////////////////// TREE CREATION


COMPLETED - QUERY RESULTS BEGIN

for(int que=0; que<q; que++)


{
string s = queries[que];
int l = s.length();
char operation = s[0];
int id = s[s.length()-1]-'0';
string valx = s.substr(2,l-4);

if(operation=='1')
{
/// lock
cout<<lock(id,m1[valx])<<"\n";
}
else if(operation=='2')
{
// unlock
cout<<unlock(id,m1[valx])<<"\n";
}
else if(operation=='3')
{
//upgrade
cout<<upgrade(id,m1[valx])<<"\n";
}
else
{
cout<<"test";
}

///////////////////////////////////////////////////////// PRINTING
cout<<"\nDETAILS----------------------------------\n";
unordered_map<string,Node*>::iterator itr;
for(itr=m1.begin(); itr!=m1.end(); itr++)
{

cout<<itr->first<<"---\n";
cout<<"isLocked: "<<itr->second->isLocked<<",LCC: "<<itr->second->lcc<<",
locked_by_id: "<<itr->second->locked_by_id;
unordered_map<Node*,int>::iterator itr2;
cout<<", Children Locked[";
for(itr2=itr->second->children_locked.begin(); itr2!=itr->second-
>children_locked.end(); itr2++)
{
cout<<itr2->first->val<<"-"<<itr2->second<<", ";
}
cout<<"]";
// for(int k=0; k<itr->second->children.size(); k++)
// {
// cout<<itr->second->children[k]<<",";
// }
cout<<"\n";
}

You might also like