⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdsl_rbtree.3

📁 一个通用的C语言实现的数据结构
💻 3
📖 第 1 页 / 共 2 页
字号:
.SS "\fBgdsl_element_t\fP gdsl_rbtree_insert (\fBgdsl_rbtree_t\fP T, void * VALUE, int * RESULT)".PPInsert an element into a red-black tree if it's not found or return it. .PPSearch for the first element E equal to VALUE into the red-black tree T, by using T's COMP_F function passed to gdsl_rbtree_alloc to find it. If E is found, then it's returned. If E isn't found, then a new element E is allocated using T's ALLOC_F function passed to gdsl_rbtree_alloc and is inserted and then returned..PP\fBNote:\fP.RS 4Complexity: O( log( |T| ) ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t & RESULT != NULL .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to modify .br\fIVALUE\fP The value used to make the new element to insert into T .br\fIRESULT\fP The address where the result code will be stored. .RE.PP\fBReturns:\fP.RS 4the element E and RESULT = GDSL_OK if E is inserted into T. .PPthe element E and RESULT = GDSL_ERR_DUPLICATE_ENTRY if E is already present in T. .PPNULL and RESULT = GDSL_ERR_MEM_ALLOC in case of insufficient memory. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_remove()\fP .PP\fBgdsl_rbtree_delete()\fP .RE.PP.SS "\fBgdsl_element_t\fP gdsl_rbtree_remove (\fBgdsl_rbtree_t\fP T, void * VALUE)".PPRemove an element from a red-black tree. .PPRemove from the red-black tree T the first founded element E equal to VALUE, by using T's COMP_F function passed to \fBgdsl_rbtree_alloc()\fP. If E is found, it is removed from T and then returned..PP\fBNote:\fP.RS 4Complexity: O( log ( |T| ) ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to modify .br\fIVALUE\fP The value used to find the element to remove .RE.PP\fBReturns:\fP.RS 4the first founded element equal to VALUE in T in case is found. .PPNULL in case no element equal to VALUE is found in T. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_insert()\fP .PP\fBgdsl_rbtree_delete()\fP .RE.PP.SS "\fBgdsl_rbtree_t\fP gdsl_rbtree_delete (\fBgdsl_rbtree_t\fP T, void * VALUE)".PPDelete an element from a red-black tree. .PPRemove from the red-black tree the first founded element E equal to VALUE, by using T's COMP_F function passed to \fBgdsl_rbtree_alloc()\fP. If E is found, it is removed from T and E is deallocated using T's FREE_F function passed to \fBgdsl_rbtree_alloc()\fP, then T is returned..PP\fBNote:\fP.RS 4Complexity: O( log( |T| ) ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to remove an element from .br\fIVALUE\fP The value used to find the element to remove .RE.PP\fBReturns:\fP.RS 4the modified red-black tree after removal of E if E was found. .PPNULL if no element equal to VALUE was found. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_insert()\fP .PP\fBgdsl_rbtree_remove()\fP .RE.PP.SS "\fBgdsl_element_t\fP gdsl_rbtree_search (const \fBgdsl_rbtree_t\fP T, \fBgdsl_compare_func_t\fP COMP_F, void * VALUE)".PPSearch for a particular element into a red-black tree. .PPSearch the first element E equal to VALUE in the red-black tree T, by using COMP_F function to find it. If COMP_F == NULL, then the COMP_F function passed to \fBgdsl_rbtree_alloc()\fP is used..PP\fBNote:\fP.RS 4Complexity: O( log( |T| ) ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to use. .br\fICOMP_F\fP The comparison function to use to compare T's element with VALUE to find the element E (or NULL to use the default T's COMP_F) .br\fIVALUE\fP The value that must be used by COMP_F to find the element E .RE.PP\fBReturns:\fP.RS 4the first founded element E equal to VALUE. .PPNULL if VALUE is not found in T. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_insert()\fP .PP\fBgdsl_rbtree_remove()\fP .PP\fBgdsl_rbtree_delete()\fP .RE.PP.SS "\fBgdsl_element_t\fP gdsl_rbtree_map_prefix (const \fBgdsl_rbtree_t\fP T, \fBgdsl_map_func_t\fP MAP_F, void * USER_DATA)".PPParse a red-black tree in prefixed order. .PPParse all nodes of the red-black tree T in prefixed order. The MAP_F function is called on the element contained in each node with the USER_DATA argument. If MAP_F returns GDSL_MAP_STOP, then \fBgdsl_rbtree_map_prefix()\fP stops and returns its last examinated element..PP\fBNote:\fP.RS 4Complexity: O( |T| ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t & MAP_F != NULL .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to map. .br\fIMAP_F\fP The map function. .br\fIUSER_DATA\fP User's datas passed to MAP_F .RE.PP\fBReturns:\fP.RS 4the first element for which MAP_F returns GDSL_MAP_STOP. .PPNULL when the parsing is done. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_map_infix()\fP .PP\fBgdsl_rbtree_map_postfix()\fP .RE.PP.SS "\fBgdsl_element_t\fP gdsl_rbtree_map_infix (const \fBgdsl_rbtree_t\fP T, \fBgdsl_map_func_t\fP MAP_F, void * USER_DATA)".PPParse a red-black tree in infixed order. .PPParse all nodes of the red-black tree T in infixed order. The MAP_F function is called on the element contained in each node with the USER_DATA argument. If MAP_F returns GDSL_MAP_STOP, then \fBgdsl_rbtree_map_infix()\fP stops and returns its last examinated element..PP\fBNote:\fP.RS 4Complexity: O( |T| ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t & MAP_F != NULL .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to map. .br\fIMAP_F\fP The map function. .br\fIUSER_DATA\fP User's datas passed to MAP_F .RE.PP\fBReturns:\fP.RS 4the first element for which MAP_F returns GDSL_MAP_STOP. .PPNULL when the parsing is done. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_map_prefix()\fP .PP\fBgdsl_rbtree_map_postfix()\fP .RE.PP.SS "\fBgdsl_element_t\fP gdsl_rbtree_map_postfix (const \fBgdsl_rbtree_t\fP T, \fBgdsl_map_func_t\fP MAP_F, void * USER_DATA)".PPParse a red-black tree in postfixed order. .PPParse all nodes of the red-black tree T in postfixed order. The MAP_F function is called on the element contained in each node with the USER_DATA argument. If MAP_F returns GDSL_MAP_STOP, then \fBgdsl_rbtree_map_postfix()\fP stops and returns its last examinated element..PP\fBNote:\fP.RS 4Complexity: O( |T| ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t & MAP_F != NULL .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to map. .br\fIMAP_F\fP The map function. .br\fIUSER_DATA\fP User's datas passed to MAP_F .RE.PP\fBReturns:\fP.RS 4the first element for which MAP_F returns GDSL_MAP_STOP. .PPNULL when the parsing is done. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_map_prefix()\fP .PP\fBgdsl_rbtree_map_infix()\fP .RE.PP.SS "void gdsl_rbtree_write (const \fBgdsl_rbtree_t\fP T, \fBgdsl_write_func_t\fP WRITE_F, FILE * OUTPUT_FILE, void * USER_DATA)".PPWrite the element of each node of a red-black tree to a file. .PPWrite the nodes elements of the red-black tree T to OUTPUT_FILE, using WRITE_F function. Additionnal USER_DATA argument could be passed to WRITE_F..PP\fBNote:\fP.RS 4Complexity: O( |T| ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t & WRITE_F != NULL & OUTPUT_FILE != NULL .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to write. .br\fIWRITE_F\fP The write function. .br\fIOUTPUT_FILE\fP The file where to write T's elements. .br\fIUSER_DATA\fP User's datas passed to WRITE_F. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_write_xml()\fP .PP\fBgdsl_rbtree_dump()\fP .RE.PP.SS "void gdsl_rbtree_write_xml (const \fBgdsl_rbtree_t\fP T, \fBgdsl_write_func_t\fP WRITE_F, FILE * OUTPUT_FILE, void * USER_DATA)".PPWrite the content of a red-black tree to a file into XML. .PPWrite the nodes elements of the red-black tree T to OUTPUT_FILE, into XML language. If WRITE_F != NULL, then use WRITE_F to write T's nodes elements to OUTPUT_FILE. Additionnal USER_DATA argument could be passed to WRITE_F..PP\fBNote:\fP.RS 4Complexity: O( |T| ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t & OUTPUT_FILE != NULL .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to write. .br\fIWRITE_F\fP The write function. .br\fIOUTPUT_FILE\fP The file where to write T's elements. .br\fIUSER_DATA\fP User's datas passed to WRITE_F. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_write()\fP .PP\fBgdsl_rbtree_dump()\fP .RE.PP.SS "void gdsl_rbtree_dump (const \fBgdsl_rbtree_t\fP T, \fBgdsl_write_func_t\fP WRITE_F, FILE * OUTPUT_FILE, void * USER_DATA)".PPDump the internal structure of a red-black tree to a file. .PPDump the structure of the red-black tree T to OUTPUT_FILE. If WRITE_F != NULL, then use WRITE_F to write T's nodes elements to OUTPUT_FILE. Additionnal USER_DATA argument could be passed to WRITE_F..PP\fBNote:\fP.RS 4Complexity: O( |T| ) .RE.PP\fBPrecondition:\fP.RS 4T must be a valid gdsl_rbtree_t & OUTPUT_FILE != NULL .RE.PP\fBParameters:\fP.RS 4\fIT\fP The red-black tree to write. .br\fIWRITE_F\fP The write function. .br\fIOUTPUT_FILE\fP The file where to write T's elements. .br\fIUSER_DATA\fP User's datas passed to WRITE_F. .RE.PP\fBSee also:\fP.RS 4\fBgdsl_rbtree_write()\fP .PP\fBgdsl_rbtree_write_xml()\fP .RE.PP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -