亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? htbtree.c

?? www工具包. 這是W3C官方支持的www支撐庫. 其中提供通用目的的客戶端的WebAPI: complete HTTP/1.1 (with caching, pipelining, PUT, POS
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*								      HTBTree.c**	BINARY TREE FOR SORTING THINGS****	(c) COPYRIGHT MIT 1995.**	Please first read the full copyright statement in the file COPYRIGH.**	@(#) $Id: HTBTree.c,v 2.25 1999/01/19 11:41:11 frystyk Exp $**** Authors:**	Arthur Secret****	4 March 94: Bug fixed in the balancing procedure***//* Library include files */#include "wwwsys.h"#include "HTUtils.h"#include "HTBTree.h"#define MAXIMUM(a,b) ((a)>(b)?(a):(b))struct _HTBTree_element {    void			*object;	/* User object */    struct _HTBTree_element	*up;    struct _HTBTree_element	*left;    int				left_depth;    struct _HTBTree_element	*right;    int				right_depth;};struct _HTBTree {    HTComparer *		compare;    struct _HTBTree_element *	top;   };PUBLIC void * HTBTree_object (HTBTElement * element){    return element ? element->object : NULL;}PUBLIC HTBTree * HTBTree_new (HTComparer * comp)    /*********************************************************    ** This function returns an HTBTree with memory allocated     ** for it when given a mean to compare things    */{    HTBTree * tree;    if ((tree = (HTBTree  *) HT_CALLOC(1, sizeof(HTBTree))) == NULL)        HT_OUTOFMEM("HTBTree_new");    tree->compare = comp;    tree->top = NULL;    return tree;}PRIVATE void HTBTElement_free (HTBTElement*  element)    /**********************************************************    ** This void will HT_FREE the memory allocated for one element    */{    if (element) {        if (element->left != NULL)    HTBTElement_free(element->left);	if (element->right != NULL)    HTBTElement_free(element->right);	HT_FREE(element);    }}PUBLIC void HTBTree_free (HTBTree*  tree)    /**************************************************************    ** This void will HT_FREE the memory allocated for the whole tree    */{    HTBTElement_free(tree->top);    HT_FREE(tree);}PRIVATE void HTBTElementAndObject_free (HTBTElement*  element)    /**********************************************************    ** This void will HT_FREE the memory allocated for one element    */{    if (element) {     /* Just in case nothing was in the tree anyway */        if (element->left != NULL)    HTBTElementAndObject_free(element->left);	if (element->right != NULL)    	    HTBTElementAndObject_free(element->right);	HT_FREE(element->object);	HT_FREE(element);    }}PUBLIC void HTBTreeAndObject_free (HTBTree*  tree)    /**************************************************************    ** This void will HT_FREE the memory allocated for the whole tree    */{    HTBTElementAndObject_free(tree->top);    HT_FREE(tree);}/*** This void is the core of HTBTree.c . It will**       1/ add a new element to the tree at the right place**          so that the tree remains sorted**       2/ balance the tree to be as fast as possible when reading it*/PUBLIC void HTBTree_add (HTBTree * tree, void * object){    HTBTElement * father_of_element;    HTBTElement * added_element;    HTBTElement * forefather_of_element;    HTBTElement * father_of_forefather;    BOOL father_found,top_found;    int depth,depth2,corrections;        /* father_of_element is a pointer to the structure that is the father of the        ** new object "object".        ** added_element is a pointer to the structure that contains or will contain         ** the new object "object".        ** father_of_forefather and forefather_of_element are pointers that are used        ** to modify the depths of upper elements, when needed.        **        ** father_found indicates by a value NO when the future father of "object"         ** is found.        ** top_found indicates by a value NO when, in case of a difference of depths        **  < 2, the top of the tree is encountered and forbids any further try to        ** balance the tree.        ** corrections is an integer used to avoid infinite loops in cases        ** such as:        **        **             3                        3        **          4                              4        **           5                            5        **        ** 3 is used here to show that it need not be the top of the tree.        */    /*    ** 1/ Adding of the element to the binary tree    */    if (tree->top == NULL)    {        if ((tree->top = (HTBTElement  *) HT_MALLOC(sizeof(HTBTElement))) == NULL)            HT_OUTOFMEM("HTBTree_add");        tree->top->up = NULL;        tree->top->object = object;        tree->top->left = NULL;        tree->top->left_depth = 0;        tree->top->right = NULL;        tree->top->right_depth = 0;    }    else    {           father_found = YES;        father_of_element = tree->top;        added_element = NULL;        father_of_forefather = NULL;        forefather_of_element = NULL;              while (father_found)        {            if (tree->compare(object,father_of_element->object)<0)	    {                if (father_of_element->left != NULL)                    father_of_element = father_of_element->left;                else 	        {                    father_found = NO;                    if ((father_of_element->left = (HTBTElement  *) HT_MALLOC(sizeof(HTBTElement))) == NULL)                        HT_OUTOFMEM("HTBTree_add");                    added_element = father_of_element->left;                    added_element->up = father_of_element;                    added_element->object = object;                    added_element->left = NULL;                    added_element->left_depth = 0;                    added_element->right = NULL;                    added_element->right_depth = 0;                }   	    }            if (tree->compare(object,father_of_element->object)>=0)            {                if (father_of_element->right != NULL)                     father_of_element = father_of_element->right;                else                 {                      father_found = NO;                    if ((father_of_element->right = (HTBTElement  *) HT_MALLOC(sizeof(HTBTElement))) == NULL)                        HT_OUTOFMEM("father_of_element->right ");                    added_element = father_of_element->right;                    added_element->up = father_of_element;                    added_element->object = object;                    added_element->left = NULL;                    added_element->left_depth = 0;                    added_element->right = NULL;                    added_element->right_depth = 0;           	        }            }	}            /*            ** Changing of all depths that need to be changed            */        father_of_forefather = father_of_element;        forefather_of_element = added_element;        do        {            if (father_of_forefather->left == forefather_of_element)            {                depth = father_of_forefather->left_depth;                father_of_forefather->left_depth = 1                             + MAXIMUM(forefather_of_element->right_depth,                                  forefather_of_element->left_depth);                depth2 = father_of_forefather->left_depth;            }            else	    {                depth = father_of_forefather->right_depth;                father_of_forefather->right_depth = 1                            + MAXIMUM(forefather_of_element->right_depth,                                  forefather_of_element->left_depth);                depth2 = father_of_forefather->right_depth;            }            forefather_of_element = father_of_forefather;            father_of_forefather = father_of_forefather->up;        } while ((depth != depth2) && (father_of_forefather != NULL));                    /*            ** 2/ Balancing the binary tree, if necessary	    ** Bugs in this part have been fixed in March 94  -  AS            */        top_found = YES;        corrections = 0;        while ((top_found) && (corrections < 7))        {            if ((abs(father_of_element->left_depth                      - father_of_element->right_depth)) < 2)	    {                if (father_of_element->up != NULL)                     father_of_element = father_of_element->up;                else top_found = NO;	    }            else 	    {                /* We start the process of balancing */                corrections = corrections + 1;                    /*                     ** corrections is an integer used to avoid infinite                     ** loops in cases such as:                    **                    **             3                        3                    **          4                              4                    **           5                            5                    **                    ** 3 is used to show that it need not be the top of the tree		    ** But let's avoid these two exceptions anyhow 		    ** with the two following conditions (March 94 - AS)                    */		if ((father_of_element->left == NULL) 		    && (father_of_element->right->right == NULL) 		    && (father_of_element->right->left->left == NULL) 		    && (father_of_element->right->left->right == NULL)) 		    corrections = 7;		if ((father_of_element->right == NULL) 		    && (father_of_element->left->left == NULL) 		    && (father_of_element->left->right->right == NULL) 		    && (father_of_element->left->right->left == NULL))		    corrections = 7;                 if (father_of_element->left_depth > father_of_element->right_depth)	        {                    added_element = father_of_element->left;                    father_of_element->left_depth = added_element->right_depth;                    added_element->right_depth = 1                                    + MAXIMUM(father_of_element->right_depth,                                          father_of_element->left_depth);                    if (father_of_element->up != NULL)		    {			/* Bug fixed in March 94  */			BOOL first_time;                        father_of_forefather = father_of_element->up;                        forefather_of_element = added_element;			first_time = YES;                        do                         {                            if (father_of_forefather->left                                 == forefather_of_element->up)                              {				  depth = father_of_forefather->left_depth;				  if (first_time)				  {				      father_of_forefather->left_depth = 1					  + MAXIMUM(forefather_of_element->left_depth,						  forefather_of_element->right_depth);					first_time = NO;				   }				   else				       father_of_forefather->left_depth = 1					   + MAXIMUM(forefather_of_element->up->left_depth,					      forefather_of_element->up->right_depth);                                depth2 = father_of_forefather->left_depth;			    }                            else			    {                                depth = father_of_forefather->right_depth;				if (first_time)				{				    father_of_forefather->right_depth = 1				      + MAXIMUM(forefather_of_element->left_depth,					       forefather_of_element->right_depth);				    first_time = NO;				}								else				    father_of_forefather->right_depth = 1				      + MAXIMUM(forefather_of_element->up->left_depth,					   forefather_of_element->up->right_depth);                                depth2 = father_of_forefather->right_depth;			    }                            forefather_of_element = forefather_of_element->up;                            father_of_forefather = father_of_forefather->up;			} while ((depth != depth2) && 				 (father_of_forefather != NULL));                        father_of_forefather = father_of_element->up;                        if (father_of_forefather->left == father_of_element)	                {                            /*                            **                   3                       3                            **               4                       5                            ** When tree   5   6        becomes    7    4                            **            7 8                          8 6                            **                            ** 3 is used to show that it may not be the top of the                            ** tree.                            */                             father_of_forefather->left = added_element;                            father_of_element->left = added_element->right;                            added_element->right = father_of_element;                        }                        if (father_of_forefather->right == father_of_element)		        {                            /*                            **          3                       3                            **               4                       5                            ** When tree   5   6        becomes    7    4                            **            7 8                          8 6                            **                            ** 3 is used to show that it may not be the top of the                            ** tree                            */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美三级韩国三级日本三斤| 国产精品乱人伦| 国产日产欧产精品推荐色| 中文字幕一区av| 韩国精品免费视频| 欧美二区三区91| 亚洲精品一二三区| 粉嫩一区二区三区性色av| 91精品综合久久久久久| 亚洲黄色小说网站| www.色综合.com| 日本一区二区三区高清不卡| 蜜臂av日日欢夜夜爽一区| 欧美色综合久久| 亚洲男帅同性gay1069| 粉嫩绯色av一区二区在线观看| 91麻豆精品国产91久久久更新时间| 亚洲欧美激情一区二区| aaa欧美色吧激情视频| 日本一区二区在线不卡| 国产精品77777| 国产网站一区二区三区| 国产在线播放一区三区四| 欧美一二三区精品| 日韩福利视频网| 91精品国产aⅴ一区二区| 亚洲第一在线综合网站| 欧美亚洲国产一区二区三区va | 2017欧美狠狠色| 美女久久久精品| 日韩欧美一区二区久久婷婷| 日韩高清国产一区在线| 91.com在线观看| 日本视频在线一区| 91精品福利在线一区二区三区| 日本亚洲三级在线| 91麻豆精品国产91久久久使用方法| 日韩电影在线免费| 日韩精品专区在线影院重磅| 男女男精品视频| 337p粉嫩大胆色噜噜噜噜亚洲| 九色|91porny| 国产日韩欧美高清在线| 成人av先锋影音| 伊人色综合久久天天| 欧美美女直播网站| 久久精品噜噜噜成人av农村| 久久亚洲精品小早川怜子| 国产91丝袜在线18| 亚洲精品免费在线| 欧美福利一区二区| 国产一区激情在线| 国产精品成人一区二区三区夜夜夜 | 99久久伊人精品| 亚洲精品综合在线| 欧美猛男男办公室激情| 国产一区二区三区高清播放| 国产精品久久久久桃色tv| 欧洲精品在线观看| 韩国视频一区二区| 中文字幕一区二区三区在线播放 | 奇米在线7777在线精品| 久久这里只有精品6| 色哟哟欧美精品| 蜜臀av亚洲一区中文字幕| 久久久亚洲国产美女国产盗摄| 成人国产精品免费观看视频| 亚洲一区自拍偷拍| 久久久久国产精品麻豆ai换脸| 97超碰欧美中文字幕| 男女激情视频一区| 亚洲欧洲av在线| 日韩无一区二区| 91麻豆成人久久精品二区三区| 免费成人性网站| 亚洲乱码国产乱码精品精可以看| 欧美一区三区二区| 99re免费视频精品全部| 久久精品国产精品亚洲红杏| 亚洲欧美日韩系列| 久久综合久久99| 欧美年轻男男videosbes| 成人一区在线看| 欧美aaaaa成人免费观看视频| 日韩一区在线播放| 久久久午夜精品理论片中文字幕| 欧美图片一区二区三区| 99久久久久久| 国产成人综合在线| 久久66热偷产精品| 亚洲电影在线播放| 亚洲裸体xxx| 国产日韩欧美一区二区三区综合| 91精品国产乱| 欧美日韩第一区日日骚| 色一情一伦一子一伦一区| 国产91丝袜在线播放0| 经典三级视频一区| 天堂va蜜桃一区二区三区漫画版 | 中文字幕在线免费不卡| 久久亚洲精华国产精华液 | 99久久精品国产网站| 日韩二区三区四区| 亚洲高清三级视频| 夜夜嗨av一区二区三区四季av| 国产精品美女久久久久aⅴ| 久久综合色综合88| 精品成人一区二区三区| 精品奇米国产一区二区三区| 欧美高清dvd| 91精品国产综合久久久蜜臀图片| 欧美性大战久久| 欧美三级电影网站| 欧美日韩日日骚| 欧美日本一区二区三区四区| 欧美日韩国产综合视频在线观看 | 丝袜美腿一区二区三区| 亚洲第一成人在线| 亚洲成人精品一区| 全国精品久久少妇| 国产在线观看一区二区 | 日韩精品欧美精品| 丝袜美腿亚洲色图| 蜜桃久久av一区| 国产一区二区三区视频在线播放| 国产剧情av麻豆香蕉精品| 懂色av中文字幕一区二区三区| www..com久久爱| 91久久线看在观草草青青| 欧美四级电影网| 日韩三级免费观看| 久久九九影视网| 日韩一区有码在线| 五月婷婷欧美视频| 激情综合色综合久久综合| 国产成人欧美日韩在线电影| www.亚洲色图| 欧美日韩精品一区二区| 日韩免费视频一区| 国产精品天干天干在线综合| 亚洲美女屁股眼交3| 日韩专区中文字幕一区二区| 国产伦精品一区二区三区视频青涩| 99九九99九九九视频精品| 欧美猛男男办公室激情| 欧美激情综合五月色丁香| 亚洲成人av资源| 国产成人精品免费视频网站| 欧美最猛黑人xxxxx猛交| 欧美成人激情免费网| 中文字幕日韩欧美一区二区三区| 婷婷一区二区三区| 成人精品在线视频观看| 欧美日韩不卡视频| 欧美激情一区二区| 午夜精品福利久久久| 成人av影视在线观看| 欧美一级理论片| 亚洲欧美一区二区三区孕妇| 麻豆91精品91久久久的内涵| 99v久久综合狠狠综合久久| 日韩一区二区麻豆国产| 亚洲精品美国一| 国产精品一区2区| 91精品国产黑色紧身裤美女| 亚洲日本中文字幕区| 老司机午夜精品99久久| 欧美视频第二页| 日韩理论电影院| 国产精品白丝av| 91精选在线观看| 亚洲地区一二三色| av在线不卡电影| 久久综合成人精品亚洲另类欧美| 亚洲国产婷婷综合在线精品| 99国产精品久久| 国产日韩欧美不卡| 国产在线精品不卡| 日韩欧美高清dvd碟片| 日韩av一级电影| 色婷婷精品久久二区二区蜜臂av| 国产欧美日韩精品一区| 国产一区二区视频在线播放| 91精品国产免费久久综合| 亚洲成人先锋电影| 欧美日韩一区二区在线视频| 亚洲女同女同女同女同女同69| 成人aaaa免费全部观看| 国产农村妇女精品| 国产成人综合在线| 中文字幕av一区二区三区高| 国产精品1区二区.| 久久久久久久久一| 国产精一品亚洲二区在线视频| 日韩精品影音先锋| 捆绑紧缚一区二区三区视频| 欧美一区二区福利视频| 蜜臀99久久精品久久久久久软件| 欧美一区国产二区| 老司机免费视频一区二区|