久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么 std::map 實現(xiàn)為紅黑樹?

Why is std::map implemented as a red-black tree?(為什么 std::map 實現(xiàn)為紅黑樹?)
本文介紹了為什么 std::map 實現(xiàn)為紅黑樹?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

為什么 std::map 實現(xiàn)為 紅黑樹?

有幾種平衡的二元搜索樹 (BST).選擇紅黑樹的設(shè)計權(quán)衡是什么?

There are several balanced binary search trees (BSTs) out there. What were design trade-offs in choosing a red-black tree?

推薦答案

可能兩種最常見的自平衡樹算法是 紅黑樹 和AVL 樹.為了在插入/更新后平衡樹,兩種算法都使用旋轉(zhuǎn)的概念,其中樹的節(jié)點被旋轉(zhuǎn)以執(zhí)行重新平衡.

Probably the two most common self balancing tree algorithms are Red-Black trees and AVL trees. To balance the tree after an insertion/update both algorithms use the notion of rotations where the nodes of the tree are rotated to perform the re-balancing.

雖然在兩種算法中插入/刪除操作都是 O(log n),但在紅黑樹重新平衡旋轉(zhuǎn)的情況下是一個 O(1) 操作,而使用 AVL 這是一個 O(log n) 操作,使得紅黑樹在重新平衡階段這方面的效率更高,也是它更常用的可能原因之一.

While in both algorithms the insert/delete operations are O(log n), in the case of Red-Black tree re-balancing rotation is an O(1) operation while with AVL this is a O(log n) operation, making the Red-Black tree more efficient in this aspect of the re-balancing stage and one of the possible reasons that it is more commonly used.

紅黑樹用于大多數(shù)集合庫,包括來自 Java 和 Microsoft .NET Framework 的產(chǎn)品.

Red-Black trees are used in most collection libraries, including the offerings from Java and Microsoft .NET Framework.

這篇關(guān)于為什么 std::map 實現(xiàn)為紅黑樹?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Assertion failed (size.widthgt;0 amp;amp; size.heightgt;0)(斷言失敗(size.width0 amp;amp; size.height0))
Rotate an image in C++ without using OpenCV functions(在 C++ 中旋轉(zhuǎn)圖像而不使用 OpenCV 函數(shù))
OpenCV: process every frame(OpenCV:處理每一幀)
Why can#39;t I open avi video in openCV?(為什么我不能在 openCV 中打開 avi 視頻?)
OpenCV unable to set up SVM Parameters(OpenCV 無法設(shè)置 SVM 參數(shù))
Convert a single color with cvtColor(使用 cvtColor 轉(zhuǎn)換單一顏色)
主站蜘蛛池模板: 久久久久久av | 久久久久亚洲av毛片大全 | 国产午夜三级一区二区三 | 亚洲电影免费 | 日日做夜夜爽毛片麻豆 | 欧美888| 伊人网站| 黄网站色大毛片 | 精品国产伦一区二区三区观看体验 | 亚洲午夜精品视频 | 一区二区三区免费 | 亚洲狠狠爱 | 欧美激情精品久久久久久变态 | 色吧久久 | 一区二区三区在线播放视频 | tube国产 | 欧美日韩在线不卡 | 成人精品啪啪欧美成 | 精品国产一区二区三区在线观看 | 在线一区二区三区 | 国产精品久久久久久久久久免费看 | 免费看国产精品视频 | 欧美三区在线观看 | 超碰日本 | 国产日韩电影 | 国产在线精品一区二区三区 | 亚洲午夜精品一区二区三区 | 日韩高清在线 | 久久成人一区 | 在线精品亚洲欧美日韩国产 | 亚洲精品乱码久久久久久蜜桃91 | 久久999 | 欧美视频成人 | 九九热在线视频 | 蜜桃一区| 一区二区三区四区不卡 | 亚洲国产成人精品女人久久久 | 欧美成人一区二区三区 | 久草新在线| 久久一二区 | 国产欧美一级 |