rt是什么| 蚕豆是什么豆| 内向的人适合什么工作| 拍肺部ct挂什么科| 吹空调喉咙痛什么原因| 阿尔茨海默症是什么症状| 来月经腰疼的厉害是什么原因| 拉杆箱什么材质的好| 胃不好的人适合吃什么水果| 什么食物是养肝的| kipling是什么牌子| 88.88红包代表什么意思| 举足轻重什么意思| 女人味是什么| 十月二十三号是什么星座| 女性长期缺维d会带来什么病| 地盆是一种什么病| 胸口疼挂什么科| 克隆恩病是什么| 生理期不能吃什么水果| 腿酸痛是什么原因| 唐氏综合征是什么原因造成的| 什么是同人文| 海藻是什么植物| 今晚吃什么| 扁平足是什么意思| 肝肾阴虚吃什么药| 六味地黄丸有什么用| 梦见小孩子是什么意思| 什么人不能吃桃子| 胰腺在人体什么部位| 有什么中药可以壮阳| 血糖高吃什么药最好| 读警校需要什么条件| 什么是梅尼埃综合症| 背痛是什么原因| 樊胜美是什么电视剧| 蜻蜓喜欢吃什么| 吃什么止咳| roa是什么意思| 纾字五行属什么| 萝卜不能和什么一起吃| 妇炎康片主要治什么妇科病| 颈椎病挂什么科最好| 念珠菌和霉菌有什么区别| 什么是洗钱| 甲状腺低密度结节是什么意思| 掌心痣代表什么意思| 痛什么什么痛| 指甲看什么科| 输血四项检查是什么| 草酸是干什么用的| 巨蟹座跟什么星座最配| 暮光是什么意思| 宫颈粘液栓是什么样的| 胃癌早期有什么症状| 什么叫人工智能| 出生医学证明有什么用| 惆怅是什么意思| 竹笙是什么| 西布曲明是什么| 五级职员是什么级别| 云裳是什么意思| 寄什么快递最便宜| 员级职称是什么意思| 晚上适合做什么运动| 静的部首是什么| 角质层是什么| 妇科和妇产科有什么区别| 黄芪是什么| 现在是什么意思| 心跳过慢吃什么药| 怀孕吃什么水果| 吃什么排便最快| 10000是什么电话| 炜字五行属什么| 一什么童话| 阿拉伯人是什么种人| 三尖瓣反流是什么意思| 认干妈有什么讲究| 强心剂是什么药| 鼻炎看什么科| coolmax是什么面料| 头发为什么会白| 其可以组什么词| 中指戴戒指什么意思| 又什么又什么的草地| 坐月子吃什么水果好| 淋巴肿瘤吃什么食物好| 迅雷不及掩耳之势是什么意思| 口腔溃疡反复发作是什么原因| 胃动力不足是什么原因造成的| 白带豆腐渣状是什么原因造成的| 贾赦和贾政是什么关系| 吃什么水果对肾有好处| 女生腋毛多是什么原因| 高血压是什么原因造成的| 外阴病变有什么症状| 栖字五行属什么| 好运是什么生肖| 女人吃鹅蛋有什么好处| 鱿鱼炒什么好吃| 影响是什么意思| 提拉米苏是什么| 虬角为什么要染成绿色| 1207是什么星座| 鞋油自然色是什么颜色| 碱中毒是什么引起的| 槟榔吃多了有什么危害| 手指发白是什么原因| 妍什么意思| 藿香正气胶囊治什么病| 心慌手抖是什么原因| 排骨粥要搭配什么好吃| 女娲和伏羲是什么关系| 降血脂有什么好办法| 女生吃避孕药有什么副作用| 补气养阴是什么意思| 乙肝表面抗体弱阳性什么意思| 什么品牌的母婴用品好| 同病相怜是什么意思| 五行属土缺命里缺什么| 减肥期间吃什么好| 健脾祛湿吃什么中成药| 背水一战什么意思| 什么是粳米| 什么东西天气越热它爬得越高| 冰点是什么意思| 冰箱为什么结冰| rna是什么意思| 众所周知是什么生肖| 做梦翻车了什么预兆| 男人为什么喜欢胸| 头孢吃多了有什么副作用| 开尔文是什么单位| 嘴唇有黑斑是什么病| n2o是什么气体| 胃胆汁反流是什么原因引起的| 性激素是查什么| 梦见朋友死了是什么意思| poscer是什么牌子手表| 过期的维生素e有什么用途| 洒水车的音乐是什么歌| 韩语思密达是什么意思| 嘉靖为什么不杀海瑞| 睡觉身上痒是什么原因| 四肢无力是什么病| 西洋参不能和什么一起吃| 胰腺炎适合吃什么食物| 氯雷他定有什么副作用| 磅礴是什么意思| 氟是什么东西| 血液透析是什么意思| 女左上眼皮跳是什么预兆| 胃胀气吃什么药好| 湿热体质吃什么食物好| 纪委书记是什么级别| 脚臭是什么原因| 胸腔积液吃什么药最有效| 最近天气为什么这么热| 半夜喉咙痒咳嗽是什么原因| 倒车雷达什么牌子好| 梦到妈妈怀孕什么预兆| esr是什么| 落荒而逃什么意思| 今天穿什么衣服合适| 晚上吃什么容易减肥| 澳门使用什么货币| 仕字五行属什么| 称心如意是什么意思| 金与什么相生相克| 宰相是现在的什么官| 公立医院是什么意思| 宜五行属什么| 什么是化学| 挂彩是什么意思| 小产后可以吃什么水果| 466是什么意思| 下呼吸道是指什么部位| 嘴唇下面长痘痘是什么原因| 尿红细胞阳性什么意思| 什么人容易得骨肿瘤| bn是什么颜色| 猴子捞月是什么生肖| 为什么会有盆腔积液| 科伦是什么药| 属马跟什么属相犯冲| 长期拉肚子是什么原因| 均一性红细胞什么意思| 打狗是什么意思| 物有所值是什么意思| 耳廓有痣代表什么| 题词是什么意思| 红曲是什么| 慈禧属什么生肖| 什么是泡沫尿| 吃什么能提高血压| 丙烯颜料用什么洗掉| 舒张压和收缩压是什么| 罗文和甄妮什么关系| 鸭肉和什么一起炖好吃| 壁虎的尾巴有什么作用| 头颅mri是什么检查| 花干是什么做的| 蠕动什么意思| 扁桃体肥大吃什么药好得快| 格局小是什么意思| 足字旁的有什么字| b型o型生出来的孩子什么血型| 滚去掉三点水念什么| 痛风不能吃什么水果| 人流后吃什么水果| 胎神是什么意思| 梦见雨伞是什么意思| 什么时候测血压最准确| 读书心得是什么意思| 霜降是什么时候| 乳头为什么会痒| hpv去医院挂什么科| 脑筋急转弯什么东西越洗越脏| 饿得快是什么原因| 肺部肿瘤3cm什么期| 什么是植发| 石榴花是什么季节开的| iqc是什么意思| 天龙八部是什么朝代| 鼻涕带血是什么原因| 吃什么补脾胃| 剖腹产后可以吃什么食物| BLD医学上是什么意思| 右脸长痣代表什么意思| 藏红花的功效是什么| 赤脚走路有什么好处| 文定之喜是什么意思| 陈皮泡酒喝有什么功效和作用| 论是什么意思| 头三个月保胎喝什么汤| 脊髓损伤有什么症状| 宝宝发烧是什么原因引起的| 江郎才尽是什么意思| 睡眠时间短是什么原因| 心脏增大吃什么药| 足跟痛是什么原因| 牙周炎是什么症状| 得偿所愿什么意思| 黑色粑粑是什么原因| c代表什么| 田七是什么| 什么的树枝| 送礼送什么烟比较好| 独立户口需要什么条件办理| 快速补血吃什么| 一什么| 北芪煲汤加什么药材好| 断念是什么意思| 薜丁山是什么生肖| 刻意是什么意思| 12月出生的是什么星座| 什么是夹腿| 红玛瑙适合什么人戴| 孕妇梦到蛇是什么意思| 明朝后面是什么朝代| 侧颜杀是什么意思| 食管有烧灼感什么原因| 百度Jump to content

人民币对美元汇率中间价报6.8949元 下调19个基

From Wikipedia, the free encyclopedia
百度 2016年11月,北京知识产权法院在涉及“家家JIAJIA及图”商标撤销复审行政纠纷案件中,就当事人在诉讼中提供伪证妨碍诉讼的行为,作出了罚款1万元的决定。

In computer science, join-based tree algorithms are a class of algorithms for self-balancing binary search trees. This framework aims at designing highly-parallelized algorithms for various balanced binary search trees. The algorithmic framework is based on a single operation join.[1] Under this framework, the join operation captures all balancing criteria of different balancing schemes, and all other functions join have generic implementation across different balancing schemes. The join-based algorithms can be applied to at least four balancing schemes: AVL trees, red–black trees, weight-balanced trees and treaps.

The join operation takes as input two binary balanced trees and of the same balancing scheme, and a key , and outputs a new balanced binary tree whose in-order traversal is the in-order traversal of , then then the in-order traversal of . In particular, if the trees are search trees, which means that the in-order of the trees maintain a total ordering on keys, it must satisfy the condition that all keys in are smaller than and all keys in are greater than .

History

[edit]

The join operation was first defined by Tarjan[2] on red–black trees, which runs in worst-case logarithmic time. Later Sleator and Tarjan [3] described a join algorithm for splay trees which runs in amortized logarithmic time. Later Adams [4] extended join to weight-balanced trees and used it for fast set–set functions including union, intersection and set difference. In 1998, Blelloch and Reid-Miller extended join on treaps, and proved the bound of the set functions to be for two trees of size and , which is optimal in the comparison model. They also brought up parallelism in Adams' algorithm by using a divide-and-conquer scheme. In 2016, Blelloch et al. formally proposed the join-based algorithms, and formalized the join algorithm for four different balancing schemes: AVL trees, red–black trees, weight-balanced trees and treaps. In the same work they proved that Adams' algorithms on union, intersection and difference are work-optimal on all the four balancing schemes.

Join algorithms

[edit]

The function join considers rebalancing the tree, and thus depends on the input balancing scheme. If the two trees are balanced, join simply creates a new node with left subtree t1, root k and right subtree t2. Suppose that t1 is heavier (this "heavier" depends on the balancing scheme) than t2 (the other case is symmetric). Join follows the right spine of t1 until a node c which is balanced with t2. At this point a new node with left child c, root k and right child t2 is created to replace c. The new node may invalidate the balancing invariant. This can be fixed with rotations.

The following is the join algorithms on different balancing schemes.

The join algorithm for AVL trees:

function joinRightAVL(TL, k, TR)
    (l, k', c) := expose(TL)
    if h(c) ≤ h(TR) + 1
        T' := Node(c, k, TR)
        if h(T') ≤ h(l) + 1
            return Node(l, k', T')
        else
            return rotateLeft(Node(l, k', rotateRight(T')))
    else 
        T' := joinRightAVL(c, k, TR)
        T := Node(l, k', T')
        if h(T') ≤ h(l) + 1
            return T
        else
            return rotateLeft(T)

function joinLeftAVL(TL, k, TR)
    /* symmetric to joinRightAVL */

function join(TL, k, TR)
    if h(TL) > h(TR) + 1
        return joinRightAVL(TL, k, TR)
    else if h(TR) > h(TL) + 1
        return joinLeftAVL(TL, k, TR)
    else
        return Node(TL, k, TR)

Where:

  • is the height of node .
  • extracts the left child , key , and right child of node into a tuple .
  • creates a node with left child , key , and right child .

The join algorithm for red–black trees:

function joinRightRB(TL, k, TR)
    if TL.color = black and ?(TL) = ?(TR)
        return Node(TL, ?k, red?, TR)
    else 
        (L', ?k', c'?, R') := expose(TL)
        T' := Node(L', ?k', c'?, joinRightRB(R', k, TR))
        if c' = black and T'.right.color = T'.right.right.color = red
            T'.right.right.color := black
            return rotateLeft(T')
        else
            return T'

function joinLeftRB(TL, k, TR)
    /* symmetric to joinRightRB */

function join(TL, k, TR)
    if ?(TL) > ?(TR)
        T' := joinRightRB(TL, k, TR)
        if (T'.color = red) and (T'.right.color = red)
            T'.color := black
        return T'
    else if ?(TR) > ?(TL)
        /* symmetric */
    else if TL.color = black and TR = black
        return Node(TL, ?k, red?, TR)
    else
        return Node(TL, ?k, black?, TR)

Where:

  • ?? is the black height of node .
  • extracts the left child , key , color , and right child of node into a tuple .
  • ?? creates a node with left child , key , color , and right child .

The join algorithm for weight-balanced trees:

function joinRightWB(TL, k, TR)
    (l, k', c) := expose(TL)
    if w(TL) =α w(TR)
        return Node(TL, k, TR)
    else 
        T' := joinRightWB(c, k, TR)
        (l1, k1, r1) := expose(T')
        if w(l) =α w(T')
            return Node(l, k', T')
        else if w(l) =α w(l1) and w(l)+w(l1) =α w(r1)
            return rotateLeft(Node(l, k', T'))
        else
            return rotateLeft(Node(l, k', rotateRight(T'))

function joinLeftWB(TL, k, TR)
    /* symmetric to joinRightWB */

function join(TL, k, TR)
    if w(TL) >α w(TR)
        return joinRightWB(TL, k, TR)
    else if w(TR) >α w(TL)
        return joinLeftWB(TL, k, TR)
    else
        return Node(TL, k, TR)

Where:

  • is the weight of node .
  • means weights and are α-weight-balanced.
  • means weight is heavier than weight with respect to the α-weight-balance.
  • extracts the left child , key , and right child of node into a tuple .
  • creates a node with left child , key and right child .

Join-based algorithms

[edit]

In the following, extracts the left child , key , and right child of node into a tuple . creates a node with left child , key and right child . "" means that two statements and can run in parallel.

Split

[edit]

To split a tree into two trees, those smaller than key x, and those larger than key x, we first draw a path from the root by inserting x into the tree. After this insertion, all values less than x will be found on the left of the path, and all values greater than x will be found on the right. By applying Join, all the subtrees on the left side are merged bottom-up using keys on the path as intermediate nodes from bottom to top to form the left tree, and the right part is asymmetric. For some applications, Split also returns a boolean value denoting if x appears in the tree. The cost of Split is , order of the height of the tree.

The split algorithm is as follows:

function split(T, k)
    if (T = nil)
        return (nil, false, nil)
    else
        (L, m, R) := expose(T)
        if k < m
            (L', b, R') := split(L, k)
            return (L', b, join(R', m, R))
        else if k > m
            (L', b, R') := split(R, k)
            return (join(L, m, L'), b, R'))
        else
            return (L, true, R)

Join2

[edit]

This function is defined similarly as join but without the middle key. It first splits out the last key of the left tree, and then join the rest part of the left tree with the right tree with . The algorithm is as follows:

function splitLast(T)
    (L, k, R) := expose(T)
    if R = nil
        return (L, k)
    else
        (T', k') := splitLast(R)
        return (join(L, k, T'), k')

function join2(L, R)
    if L = nil
        return R
    else
        (L', k) := splitLast(L)
        return join(L', k, R)

The cost is for a tree of size .

Insert and delete

[edit]

The insertion and deletion algorithms, when making use of join can be independent of balancing schemes. For an insertion, the algorithm compares the key to be inserted with the key in the root, inserts it to the left/right subtree if the key is smaller/greater than the key in the root, and joins the two subtrees back with the root. A deletion compares the key to be deleted with the key in the root. If they are equal, return join2 on the two subtrees. Otherwise, delete the key from the corresponding subtree, and join the two subtrees back with the root. The algorithms are as follows:

function insert(T, k)
    if T = nil
        return Node(nil, k, nil)
    else
        (L, k', R) := expose(T)
        if k < k'
            return join(insert(L,k), k', R)
        else if k > k'
            return join(L, k', insert(R, k))
        else
            return T

function delete(T, k)
    if T = nil
        return nil
    else
        (L, k', R) := expose(T)
        if k < k'
            return join(delete(L, k), k', R)
        else if k > k'
            return join(L, k', delete(R, k))
        else
            return join2(L, R)

Both insertion and deletion requires time if .

Set–set functions

[edit]

Several set operations have been defined on weight-balanced trees: union, intersection and set difference. The union of two weight-balanced trees t1 and t2 representing sets A and B, is a tree t that represents AB. The following recursive function computes this union:

function union(t1, t2)
    if t1 = nil
        return t2
    else if t2 = nil
        return t1
    else
        (l1, k1, r1) := expose(t1)
        (t<, b, t>) := split(t2, k1)
        l' := union(l1, t<) || r' := union(r1, t>)
        return join(l', k1, r')

Similarly, the algorithms of intersection and set-difference are as follows:

function intersection(t1, t2)
    if t1 = nil or t2 = nil
        return nil
    else
        (l1, k1, r1) := expose(t1)
        (t<, b, t>) = split(t2, k1)
        l' := intersection(l1, t<) || r' := intersection(r1, t>)
        if b
            return join(l', k1, r')
        else
            return join2(l', r')

function difference(t1, t2)
    if t1 = nil
         return nil
    else if t2 = nil
         return t1
    else
        (l1, k1, r1) := expose(t1)
        (t<, b, t>) := split(t2, k1)
        l' = difference(l1, t<) || r' = difference(r1, t>)
        if b
            return join2(l', r')
        else
            return join(l', k1, r')

The complexity of each of union, intersection and difference is for two weight-balanced trees of sizes and . This complexity is optimal in terms of the number of comparisons. More importantly, since the recursive calls to union, intersection or difference are independent of each other, they can be executed in parallel with a parallel depth .[1] When , the join-based implementation applies the same computation as in a single-element insertion or deletion if the root of the larger tree is used to split the smaller tree.

Build

[edit]

The algorithm for building a tree can make use of the union algorithm, and use the divide-and-conquer scheme:

function build(A[], n)
    if n = 0
        return nil
    else if n = 1
        return Node(nil, A[0], nil)
    else
        l' := build(A, n/2) || r' := (A+n/2, n-n/2)
        return union(L, R)

This algorithm costs work and has depth. A more-efficient algorithm makes use of a parallel sorting algorithm.

function buildSorted(A[], n)
    if n = 0
        return nil
    else if n = 1
        return Node(nil, A[0], nil)
    else
        l' := build(A, n/2) || r' := (A+n/2+1, n-n/2-1)
        return join(l', A[n/2], r')

function build(A[], n)
    A' := sort(A, n)
    return buildSorted(A, n)

This algorithm costs work and has depth assuming the sorting algorithm has work and depth.

Filter

[edit]

This function selects all entries in a tree satisfying a predicate , and return a tree containing all selected entries. It recursively filters the two subtrees, and join them with the root if the root satisfies , otherwise join2 the two subtrees.

function filter(T, p)
    if T = nil
        return nil
    else
        (l, k, r) := expose(T)
        l' := filter(l, p) || r' := filter(r, p)
        if p(k)
            return join(l', k, r')
        else
            return join2(l', R)

This algorithm costs work and depth on a tree of size , assuming has constant cost.

Used in libraries

[edit]

The join-based algorithms are applied to support interface for sets, maps, and augmented maps [5] in libraries such as Hackage, SML/NJ, and PAM.[5]

Notes

[edit]

References

[edit]
  1. ^ a b Blelloch, Guy E.; Ferizovic, Daniel; Sun, Yihan (2016), "Just Join for Parallel Ordered Sets", Symposium on Parallel Algorithms and Architectures, Proc. of 28th ACM Symp. Parallel Algorithms and Architectures (SPAA 2016), ACM, pp. 253–264, arXiv:1602.02120, doi:10.1145/2935764.2935768, ISBN 978-1-4503-4210-0
  2. ^ Tarjan, Robert Endre (1983), "Data structures and network algorithms", Data structures and network algorithms, Siam, pp. 45–56
  3. ^ Sleator, Daniel Dominic; Tarjan, Robert Endre (1985), "Self-adjusting binary search trees", Journal of the ACM, Siam
  4. ^ Adams, Stephen (1992), "Implementing sets efficiently in a functional language", Implementing sets efficiently in a functional language, Citeseer, CiteSeerX 10.1.1.501.8427.
  5. ^ a b Blelloch, Guy E.; Ferizovic, Daniel; Sun, Yihan (2018), "PAM: parallel augmented maps", Proceedings of the 23rd ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, ACM, pp. 290–304
[edit]
  • PAM, the parallel augmented map library
  • Hackage, Containers in Hackage
尾盘放量拉升意味着什么 舌苔腻是什么意思 品种是什么意思 生姜什么时候吃最好 中药一般什么时候喝最好
疫情是什么 什么汤什么火 小米可以和什么一起煮粥 身上老是痒是什么原因 历久弥新是什么意思
爱心是什么意思 5月26是什么星座 腰疼不能弯腰是什么原因引起的 头皮上长疣是什么原因造成的 高压和低压差值在什么范围正常
座是什么结构 局灶癌变是什么意思 什么品种的芒果最好吃 组织委员的职责是什么 白茶属于什么茶类
中国防御系统叫什么hcv8jop2ns1r.cn 血红蛋白偏高是什么原因baiqunet.com 爆表是什么意思hcv8jop0ns0r.cn 通奸是什么意思hcv9jop5ns6r.cn 紫得什么hcv8jop5ns7r.cn
77年的蛇是什么命hcv7jop9ns6r.cn 长期口臭吃什么药hcv9jop6ns1r.cn 整天放屁是什么原因hlguo.com 梦到头发白了是什么意思hcv9jop1ns5r.cn 金字旁的字有什么jinxinzhichuang.com
形声字是什么意思hcv9jop1ns4r.cn 宿命是什么意思hcv9jop0ns8r.cn 喉咙痛可以吃什么hcv7jop9ns0r.cn 血友病是什么病hcv9jop4ns5r.cn 容易静电的人说明什么yanzhenzixun.com
坐骨神经痛挂什么科96micro.com 6.1什么星座hcv8jop4ns7r.cn 中国属于什么半球hcv9jop6ns0r.cn 腰痛宁为什么晚上吃hcv9jop4ns4r.cn 梦见自己流血是什么预兆hcv8jop5ns7r.cn
百度