coder123
BAN USER
Comments (5)
Reputation 10
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
1
of 1 vote
Stack s1;
node nList[N];
for (i=0;i<N;i++){
if (preorderList[i].type=='N' && nList[i].parent==NULL){
nList[i].parent = pop(s1);
s1.push(i);
nList[i].left = i+1;
nList[i+1].parent=i;
}
else if (preorderList[i].type=='S' && nList[i].parent==NULL){
nList[i].parent = pop(s1);
nList[i].parent.right = i;
}
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Thanks for pointing that out! Please check the code once again now.
- coder123 January 28, 2012