
Заготовки по С / Динамические структуры / GDSL / Исходники / doc / latex / refman
.pdf
|
4.1 Low level binary tree manipulation module |
17 |
||
|
Returns: |
|
|
|
|
the height of T. |
|
||
See also: |
|
|
||
|
|
gdsl_bintree_get_size()(p. 17) |
|
|
4.1.2.14 |
ulong _gdsl_ tree_get_size ( onst _gdsl_bintree_t |
|
||
|
Get the size of a low-level binary tree. |
|
||
Note: |
|
T) |
|
|
|
|
|
||
Parameters:retheTnothingComplexity:ondition:Theumber.low-levelofO(elementsbinaryT) treeofTto(noteduse. |
|
|||
Returns: |
| | |
|
SeeSet4.1.the2also:.15gdslrootvoelementbintreenstidgdslofgetaelemenlowbinheight()-treelevel binarysetE(p).|16)Ttreeontent|). . |
(_gdsl_bintree_t T, |
|
M dify the root element of the low-level binary tree T to E. |
||
Note: |
|
|
re ondition:y: O( 1 ) |
|
|
Complexitust be a non-empty _gdsl_bintree_t. |
|
|
Parameters: |
|
|
T |
lo -level binary tree to modify. |
|
E |
The new T's root ontent. |
|
See also:gdsl_bintree_get_ ontent(p. 13)
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

18 |
|
|
v id _ |
|
|
_bin |
|
_ |
|
gdsl Module Do umentation |
||||||
|
4.1.2.16 |
|
|
|
|
parent (_gdsl_bintree_t T, |
|
|||||||||
|
|
|
|
onst _ |
|
|
bintreee setP) |
|
|
|||||||
|
Set the parent |
|
|
gdslof a ow-level |
|
|
tree. |
|
|
|||||||
|
M dify the parentreeof the low-levelbinary tree T to P. |
|||||||||||||||
Note: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
re ondition:y: O( 1 ) |
|
|
|
|
|
|
|
||||||||
|
Complexitust be a non-empty _gdsl_bintree_t. |
|||||||||||||||
Parameters: |
-level binary tree to modify. |
|
|
|||||||||||||
|
T |
|
|
lo |
|
|
||||||||||
|
P |
The new T's parent. |
|
|
|
|
|
|
||||||||
See also: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
gdsl_bintree_get_parent()(p. 14) |
|
|
||||||||||||
4.1.2.17 |
|
v |
_gdsl |
|
bin |
|
_set_left (_gdsl_bintree_t T, onst |
|||||||||
|
|
|
|
oidgsl_bintree_treeL) |
|
|
|
|||||||||
|
Set left sub-tree of a low-level binary tree. |
|
|
|||||||||||||
|
M dify the left sub-tree of the low-level binary tree T to L. |
|||||||||||||||
Note: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Complexity: O( 1 ) |
|
|
|
|
|
|
|
||||||||
|
re ondition: |
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
ust be a non-empty _gdsl_bintree_t. |
||||||||||||||
Parameters: |
-level binary |
|
to modify. |
|
|
|||||||||||
|
T |
|
|
lo |
|
|
|
|||||||||
|
L |
The new T's left sub-tree. |
|
|
|
|
||||||||||
See also: |
|
|
|
|
s |
|
|
|
|
. 18) |
|
|
||||
|
_gdsl_bintree_get_right()(p. 15) |
|
|
|||||||||||||
4.1.2.18 |
|
v |
_gdsl |
|
|
left() p. 14) |
|
|
||||||||
|
|
bin |
|
|
set_right (_gdsl_bintree_t T, onst |
|||||||||||
|
Set righ |
|
oidgsl |
|
bintree |
treeR) |
|
|
|
|||||||
|
sub- |
|
of a low-level binary tree. |
|
|
|||||||||||
|
Modify the rightreesub- |
|
|
of the low-level binary tree T to R. |
||||||||||||
|
|
|
|
|
|
|
|
treeG nerated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen |
|

|
4.1 Low level binary tree manipulation module |
19 |
|||||||
|
Note: |
|
|
|
|
|
|
|
|
P |
re ondition:y: O( 1 ) |
|
|
|
|
|
|||
Complexitust be a non-empty _gdsl_bintree_t. |
|
||||||||
|
arameters:R Th new T's righ |
sub-tree. |
|
|
|
||||
|
|
T |
lo |
-level binary tree to modify. |
|
||||
See also: |
|
s |
l |
|
. |
8) |
|
||
|
|
|
|
|
left() p.14) |
|
|||
|
|
_gdsl_bintree_get_right()(p. 15) |
|
||||||
4.1.2.19 |
_ |
_bin |
_ _gdsl_bintree_rotate_left |
|
|||||
|
|
TComplexity:rotateondition:left& r(T)rotation( lowgdslmust-O(levelofbethe1binbinary)nontreelow-emptye-levtrteel.binaryTgdsl) _treebintreeT._t. |
|
||||||
PNote:DoLeftrea |
|
|
|
|
|
|
|
||
|
arameters: |
|
|
|
|
|
|
||
|
|
The low-level binary tree to rotate. |
|
||||||
|
|
the modi ed T left-rotat d. |
|
|
|
|
|||
Returns: |
|
|
|
|
|
|
|
||
See also: |
|
|
|
|
|
()(p. 19) |
|
||
|
|
_gdsl_bintree_rotate_right |
|
||||||
|
|
left()(p. 20) |
|
||||||
4.1.2.20 |
_ |
_bin |
|
left |
|
righ |
|
||
_t _gdsl_bintree_rotate_right |
|
Note:RighaComplexity:righrotaterotationDoGenerated on( ThugdsllowJunO(-levelof1bin22the)tree11:15:30binarylowe -levttr2006eelT.binary)for gdsltreeby DoxygenT.

20 |
|
|
|
|
|
|
|
|
gdsl Module Do umentation |
re ondition: |
|
|
|
|
|
|
|||
|
|
& l(T) must be non-empty _gdsl_bintree_t. |
|||||||
Parameters: |
|
|
|
|
|
|
|||
|
T |
The low-level binary tree to rotate. |
|
||||||
Returns: |
|
|
|
|
|
|
|
||
|
the modi ed T right-rotated. |
|
|
|
|
||||
See also: |
|
|
left |
()(p. 19) |
|
||||
|
|
|
|
|
|
|
righ |
|
|
|
_gdsl_bintree_rotate_right |
|
left()(p. 20) |
||||||
4.1.2.21 |
_ |
_bin |
_t _gdsl_bintree_rotate_left_right |
||||||
Note:DoLeftrea-Complexity:rightondition:doublerotate( leftgdsl-rightaO(low1bin-rotation)leveltreeebinarytof theTtree)low.-level binary tree T. |
|||||||||
P |
|
|
|
|
|
|
|
|
|
|
|
& l(T) & r(l(T)) must be non-empty _gdsl_bintree_t. |
|||||||
arameters: |
|
|
|
|
|
|
|||
|
T |
The low-level binary tree to rotate. |
|
||||||
Returns: |
|
|
|
|
|
|
|
||
|
the modi ed T left-righ -rotated. |
|
|
|
|||||
See also: |
|
|
|
|
|
p. 19) |
|
||
|
_gdsl_bintree_rotate_left()righ |
|
|||||||
|
left()(p. 20) |
||||||||
4.1.2.22 |
_ |
_bin |
|
|
()(p. 19) |
|
|||
_t _gdsl_bintree_rotate_right_left |
Note:DoRighaComplexity:double-left rotate( rightgdslaO(-leftlow1bin-rotationGenerated)leveltreeebinarytofontheTtreeThu)low.Jun-level22 11:15:30binary tree2006Tfor. gdsl by Doxygen

|
4.1 Low level binary tree manipulation module |
21 |
||||||
|
Pre ondition: |
|
|
|
|
|
||
|
T & r(T) & l(r(T)) must be non-empty _gdsl_bintree_t. |
|
||||||
Parameters: |
|
|
|
|
|
|||
|
T The low-level binary tree to rotate. |
|
||||||
Returns: |
|
|
|
|
|
|
||
|
the modi ed T right-left-rotated. |
|
|
|||||
See also: |
|
|
|
() p. 19) |
|
|||
|
|
|
|
|
right()(p. 19) |
|
||
|
_gdsl_bintree_rotate_left |
|
right()(p. 20) |
|
||||
4.1.2.23 |
_ |
|
gdsl bintree map pre x ( onst |
|||||
|
|
|
|
bintree_t T, onst gdsl_bintree map |
fun _t |
|||
|
|
|
|
onitsMAPtheFary,lastealowvoidhtreeSTOP,examinat-nodelevinelUSERprebinarywithedxedthenodetreeDATAgdslorderUSER.T.bin) preDATAtreexedmapargumentorder.preThe.Ifx()MAP(p.21)F- |
||||
|
|
|
gdslofbi |
|
|
|
|
|
|
|
|
alled |
|
|
|
|
|
|
|
|
lev |
|
|
|
|
|
|
|
lsowisnodesGDSLreturnsMAP- |
|
|
|
|
|
|
|
Parserepsurionandl |
|
|
|
|
|
|
|
Note:stFfun |
|
|
|
|
|
|
Parameters:reMAPTMAPComplexity:ondition:TheFlowF!=The-levelNULLO(map|binaTUser's| )funytreetionto. map. |
|
USER_DA A |
datas. |
Returns:the rst node for whi h MAP F returns GDSL_MAP_STOP. NULL when the parsing is done.
See also:gdsl_bintree_map_inpostx()x()(p.(p22). 22)
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

22 |
|
|
|
gdsl Module Do umentation |
||
|
4.1.2.24 |
|
|
gdsl bintree map in x ( onst |
|
|
|
|
|
_gdsl |
bintree_t |
T, onst gdsl_bintree_map fun _t |
|
|
|
allisownodesMAP-alledlevelitsMAPlastofonbinaryO(theFexaminatedaSTOP,, voidhlowtreenode-levelthenwithUSERnodenbinaryxedthegdsl. USERorderDATAtreebintree.T DATA)in in mapxedargumentorderin .x(). IfThe(pMAP.22)MAPstopsFreF- |
||||
|
unrnstionComplexity:returnsGDSL |
|
|
|
||
|
Parse |
|
|
|
|
|
Note:andf |
|
|
|
|
Parameters:reUSERMAPTMAPondition:TheFlowFDA!=-ThelevelNULLAmap|binaTUser's| )funytreedatastionto.. map.
Returns:the rst node for whi h MAP F returns GDSL_MAP_STOP. NULL when the parsing is done.
See also: gdsl_bintree_map_preostx()x()(p(p. 21). 22)
4.1.2.25 _gdsl bintree_t T,gdslonstbintreegdsl_mapbintreepostmapx ( funonst_t
Note:stFfunParsereturpstionComplexity:aallsdowisnodesGDSLreturnsMAP-levelalledofbiO(MAPonitstheFary,lastealowvoidhtreeSTOP,examinated-levnodeinelUSERbinarypostthenwithxedthenogtreeDATAdorderUSERsl.T bin.)_posttreeDATAxedmapargumenorderpost.The.Ifx()MAP(p.22)F-
Parameters:reMAPTondition:TheFlow!=-levelNULL|binaryTGenerated| ) tree onto ThumapJun. 22 11:15:30 2006 for gdsl by Doxygen

4.1 Low level binary tree manipulation module |
23 |
||
MAP_F |
map fun tion. |
|
|
USER_DATheA User's datas. |
|
|
|
Returns: |
|
|
|
the rst node for whi h MAP F returns GDSL_MAP_STOP. |
|
||
NULL when the parsing is done. |
|
|
|
See also: |
pre x()(p. 21) |
|
|
gdsl_bintree_map_in x()(p. 22) |
|
||
4.1.2.26 v id _ |
_bin _ |
( onst _gdsl_bintree_t T, |
|
onst gdslFILEbintree,voidewrite_fun _treeWRITE_F, FILE |
|
||
OUTPUT |
|
||
WriteWRITEComplexity:the nontendesFF.funonO(oftionentsall.noAfdesdditionnaltheoflow-lolevelUSER-levelUSERbinarybinaDATAtreeDATAy Targumentoto)OUTPUTtle.ould_beFILE,passedus- |
|||
Note:toing |
|
|
|
|
|
|
|
datasfunOUTPUTle whereionwrite.to.FILEwrite!=T'sNULLnodes. |
||
Parameters:reOUTPUTWRITEondition:The lowF-Flevel!=FILETheNULL|binaryTwrite| )The&tree |
|
|||||
USER_DATA User's |
|
|
passed to WRITE_F. |
|||
See also: |
|
write |
xml()(p. 23) |
|||
gdsl_bintree_dump()(p. 24) |
||||||
4.1.2.27 |
void _gdsl |
bintree write xml ( onst gdsl bintree t |
||||
|
T, |
|
gdsl |
|
bintree write fun t WRITE F, FILE |
|
WriteouldnodeslanguagbethepassedononThuOUTPUTtenten.onstIftoJunWRITEoftotentsa22OUTPUTlow11:15:30of-FILEleveltheFF!=.low2006binary,NUFIvoid-levelLforEL,tree.gdslbinarythenAdditionnalUSERtobyusesatreeDoxygenleWRITEOUTPUTDATAinUStoXMLR) FDA.fun AtionFILE,argumenttowriintoe |
||||||
GeneratedT'sXML |
|
|
|
|
|
|
|
|
|
|
|
|
|

24 |
gdsl Module Do umentation |
|
Note: |
|
|
Parameters:reOUTPUTWRITEOUTPUTComplexity:ondition:The low-FlevelFILEO(FILEThe|binaryT!=write| )TheNULLtreefunle twhereionwrite.to. write T's nodes. |
|
|
USER_DATA User's datas passed to WRITE_F. |
|
|
See also: |
write()(p. 23) |
|
gdsl_bintree_dump()(p. 24) |
|
|
4.1.2.28 v id _ |
_bin _ ump ( onst _gdsl_bintree_t T, |
|
onst gdslFILEbintree,vlevoidwrite_fun treeWRITE_F, FILE |
|
|
OUTPUT |
|
|
WRITEtoDumpOUTPUTComplexity:theFin.s!=ternalruFILENULL,tureO(stru.AdditionnalofthentureuseoflowWRITEa- USERwel-levelbinaryUSERFDATAbinaryfuntreetionDATAargumenTtotowri)atOUTPUTeT'sleould.nodesbepassedFILEontents.toIf |
||
Note: |
|
|
Parameters:reOUTPUTWRITEOUTPUTondition:The low-FlevelFILEFILEThe|binaryT!=write| )TheNULLtreefunle twhereiondump.to. write T's nodes.
USER_DATA User's datas passed to WRITE_F.
See also:gdsl_bintree_write()(pxml(. 23)(p. 23)
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

.2 Low-level binary sear h tree manipulation module |
|
25 |
|||||||||||||
4.2 Low-level |
binary |
sear h |
tree |
manipulation |
|
||||||||||
|
module |
bintree |
|
gdsl |
|
|
_ |
|
|
|
|
|
|||
Typedefs |
_gdsl |
|
|
|
|
|
|
|
|
||||||
|
GDSL low-level binary sear h |
ee typbstree. |
|
|
|
|
|
|
|||||||
|
typedef |
|
|
|
|
|
|
|
|
|
|
|
|
||
ˆ TREE, voidnt( |
_gdsl_bstree_mapfun tion_typ )(_gdsl_bstree_t |
||||||||||||||
ˆ |
|
|
id(-levelUSERbinaryDATA)searbstreeh ee |
|
|
e. |
|
|
|
|
|||||
|
typedefGDSLvlow |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
TREE, FILE |
_gdsl_ |
|
_write_ |
|
_ |
)(_gdsl_bstree_t |
||||||||
ˆ _tionsgdslDestrCrGDSLatebstreea new-levelbstreeOUTPUTlowbinary-levelgdslbinarysearFILE,bstreeh seareevoidhallotrbstreeUSER. ( onstDATA)typegdsl. _element_t E) |
|||||||||||||||
Fun |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
gdsl |
F) |
_free ( |
gdsl |
|
|
_ T, |
onst |
gdsl_free_- |
||||
|
fun _ FREE |
|
|
|
|
|
|
|
|
|
|
|
|||
ˆ |
gdsl |
oy a low-level binary sear h tree. |
|
|
|
|
|
|
|
||||||
bstree |
t |
gdsl |
|
|
opy ( onst _gdsl_bstree_t T, |
||||||||||
|
|
opy a low-level binary searbstreeh . |
F) |
|
|
|
|
|
|
|
|||||
|
onst gdsl opy |
fun _t COPY |
gdsl_bstree |
|
T) |
||||||||||
|
bool |
gdsl |
|
_is |
empty ( on t |
T) |
|||||||||
ˆ |
|
leaf ( onst _gdsl . |
|
|
|
|
|||||||||
gdsl elemenbstree_gdsl bstree |
get |
onten |
|
( onst _gdsl_- |
|||||||||||
|
Che k if a low-level binary sear h tree is emptyr du d o a l af. |
|
|
|
|||||||||||
|
Get |
the root ont nt of |
low-level binary sear hbstree. |
|
|
|
|
||||||||
|
str e |
T) |
|
is |
root ( onst _gdsl |
|
|
T) |
|||||||
|
bool |
gdsl |
|
|
|
||||||||||
|
Che k if a low-level binary sear h |
e is a root. |
|
|
|
|
|
||||||||
ˆ |
Get |
the parentbstreeof a low-level |
sear h trbstree. |
|
|
|
|||||||||
gdsl |
bstree |
|
gdsl bstree get_paren |
|
( onst _gdsl_- |
||||||||||
|
bstr e |
T) |
|
|
|
|
|
|
|
|
|
|
|
|
|
Generated on Thu Jun 22 11:15:30 2006 for binarygdsl y Doxygen |
|
|
|
|
|

26 |
|
|
|
|
|
|
|
|
gdsl Module Do umentation |
||||
|
ˆ gdsl_bstree_ |
|
_gdsl_bstree get_left ( onst _gdsl_bstree_t |
||||||||||
|
T) Get the left subree of a low-level binary sear h tree. |
( onst |
_gdsl_- |
||||||||||
|
ˆ gdsl |
bstreeT) |
_t |
|
gdsl |
bstree |
get |
righ |
|||||
|
bstree |
|
|
|
of a low-level bi |
ary |
ar h tr . |
|
|
||||
|
|
|
right sub- |
|
|
||||||||
|
ulong |
gdsl_ |
|
|
_get |
size |
_gdsl_bstree_ T) |
||||||
|
|
|
heigh( onst( onst |
|
gdsl_bstree_ |
T) |
|||||||
|
Get the |
size of |
of |
low-level binary sear h tr . |
|
|
|
|
|||||
|
|
|
|
low-level |
inary sear h tr e. |
|
|
|
ˆVALUE,onstgdslgdslbsinheightreeomparebstree gdslfun_bstreeCOMPinsertF, (onstgdslgdslbstreeel menteturnT,
ˆgdslInsertit. elemenan lementRESULT)intogdsla low_-bstreelevel binaryremovear h tree( onstifgdslit's notbstreefound ortr
ˆVALUE)T,VALUE)onstgdslRemoveSearonstgdslhbstreegdslforanaelementompareponstomparei ularfromgdslelementfunafunlow-levintoCOMPlCOMPabinsearlowry-levelhF,searF,binaryhtree.seargdslgdslgdslh trelementbstreeelemen. __T,tt
ˆ |
gdsl |
|
T, |
|
gdsl_ |
|
sear h next |
( onst _ |
|
|
bstree |
|
gdsl |
|
bstree_fun t COMP |
F, onst gdsl_- |
|||
|
bstree |
bstree, onst |
|
gdsl_ |
map fun _( onstMAP_F, void |
||||
|
sear h |
e, a |
rding to theomparin yartise ulh trelemorder. |
|
|||||
|
element |
VALUE) |
element of |
nt into a low-level binary |
|||||
ˆ |
Se |
|
for the |
|
|||||
gdsl |
|
|
next_gdsl |
|
_map pre x |
_gdsl - |
ˆbstreeUSERgdslParse_bstreeDAa lowT,A)-levelonstbinarygdslgdslsearbstreeh in__premapmapxed__inorderfunx. _( onstMAP__F,gdslvoid-
USERParse_DAa lowTA)-levelGeneratedbinary searon Thuh Junin22in11:15:30xed order2006. for gdsl by Doxygen