region — code is the retrieval geocode for
the knowledge
node in regional tree.
success is the state of operation.
root node is the pionter to root node of
regional tree.
p and pl are the pointer to stored struc-
ture.
retrieval node algorithm is as follows:
transfering paraments include:
region _ code, p, pl, count, root node,
Succese;
Begin
if root node = nil then goto step 4
else count = length of region code;
i= 1;
pl= p = root node;
step 1;
if p—geo code —region code[i];
goto step 2
if p—>geo _ code < region code[i];
goto step 3
if p— geo _ code > region _ code [i];
goto step 4
step 2:
if i—count, then goto step 5
else pl—p;
p —leftlink
if p— nil, goto step 4;
else i —i-d-1 goto step 1;
step 3:
pl-p
p = p—rightlink
if p=nil, then goto step 4
else goto stepl
step 4: success =0, return(pl)
end of retrieval node because
knowledge node doesn’t exist
step 5; success —1, return(p)
end of retrieval node because
knowledge node has been found.
end of arlorithm.
insert node arlorithm is given as follows:
364
transfering paraments include;
region code,p,pl,count,root _ node , suc-
cese ;
Begin
call retrieval _ node (region code,p,pl,
count ,root _ node ,succese ) ;
if success = 1 ;
end of insert node because knowledge
has exist.
else execute followinf procedures;
if root node = nil,
then insert new node (1);
else p =pl,i =1;
stepl:
if p=root node, goto step 2;
else p=p—uplink,i=i+1,
goto stepl;
Step 2
if pl—geo code «region code[i];
then pl=p1rightlink ;
when pl =nil,insert new _node[i],
goto step 3;
when pl not nil,goto step2;
else if pl geo code region code[i]
then insert new node[i],
goto step 3;
else goto step3;
step 3
if i=count ,complete insert operation,
exit;
else i =i+1,pl=pl-liftlink,
goto step 2;
end of arlorithm.
inherit knowledge arlorithm is following list ;
transfering paraments include:
region _ code,p,pl,count,root _ node , suc-
cese ;
Begin
call retrieval _ node (region _code,p,pl,
count ,root _ node ,succese ) ;
if success = 0;
edg«
can
add
kno
son
ima
of k
spe:
sma
kno
can
sifie
ofi
3. Ti
Cor]
gra]
diff
is a
x
mo
plai
maj
twe
reg
an
dat:
tute
. th
COT]