Home > Back-end >  Signal amplifier placement program, several problems in the solution
Signal amplifier placement program, several problems in the solution

Time:10-02

BTREE CreatBT ()//set up binary tree according to the logical structure, in turn, the input node, the parent node, symbols, weight
{
cout<& lt;" Please input binary tree according to the logical structure "& lt; Bnode p;
Squeue q;
BTREE root, s;
The root=new node;
The root=NULL;
Makenull (q);
cin> Conviction yourself ata> P.p arent> P.t ag> P.w eight;
While (conviction yourself ata!='0')
{
S=new node;
S - & gt; data=https://bbs.csdn.net/topics/p.data;
S - & gt; Weight=p.w eight;
S - & gt; Lchild=s - & gt; Rchild=NULL;
Q.r ear=(q.r ear + 1) % 100;
Q.e le [q.r ear]=s;
If (p.p arent=='0')
The root=s;
The else
{
While (q.r ear + 1% in 100.=q.f ront& & Q.e le [q.f ront] - & gt; The data!=p.p arent)
Q.f ront=(q.f ront + 1) % 100;
If (q.e le [q.f ront] - & gt; data=https://bbs.csdn.net/topics/=p.parent)
{
If (p.t ag=='L')
Q.e le [q.f ront] - & gt; Lchild=s;
The else
Q.e le [q.f ront] - & gt; Rchild=s;
}
}
cin> Conviction yourself ata> P.p arent> P.t ag> P.w eight;
}
return root;
}
This is one of the established binary tree algorithm,
When debugging tips if (q.e le [q.f ront] - & gt; data=https://bbs.csdn.net/topics/=p.parent) the line
Expression always be evaluated
0 xc0000005: Access Violation
What symbol "this" not fount
Because I itself is not the professional - so don't understand, is probably q.e le [q.f ront] no initialization?
Want to ask about this how to change?
  • Related