B-heap

A B-heap is a binary heap implemented to keep subtrees in a single page. This reduces the number of pages accessed by up to a factor of ten for big heaps when using virtual memory, compared with the traditional implementation.[1] The traditional mapping of elements to locations in an array puts almost every level in a different page.

There are other heap variants which are efficient in computers using virtual memory or caches, such as cache-oblivious algorithms, k-heaps,[2] and van Emde Boas layouts.[3]

Motivation

Traditionally, binary trees are laid out in consecutive memory according to a n -> {2n, 2n+1} rule, meaning that if a node is at position n, its left and right child are taken to be at positions 2n and 2n+1 in the array. The root is at position 1. A common operation on binary trees is the vertical traversal; stepping down through the levels of a tree in order to arrive at a searched node. However, because of the way memory is organized on modern computers into pages in virtual memory, this scheme of laying out the binary tree can be highly ineffective. The reason is that, as when traversing deeper into the tree, the distance to the next node grows exponentially, so every next node retrieved will likely be on a separate memory page. This will increase the number of page misses, which are very expensive. The B-heap solves this problem by laying out child nodes in memory in a different way, trying as much as possible to position subtrees within a single page. Therefore, as a vertical traversal proceeds, several of the consecutive retrieved nodes will lay in the same page, leading to a low number of page misses.

Implementation

In detail, a b-heap can be implemented in the following way. Poul-Henning Kamp[4] gives two options for the layout of the nodes: one in which two positions per page are wasted, but the strict binary structure of the tree is preserved, and another which uses the whole available space of the pages, but has the tree fail to expand for one level upon entering a new page (The nodes on that level have only one child). In any case, an important point is that upon leaving a page, both child nodes are always in a common other page, since in a vertical transversal the algorithm will typically compare both children with the parent to know how to proceed. For this reason, each page can be said to contain two parallel subtrees, interspersed with each other. The pages themselves can be seen as a m-ary tree, and since half of the elements in each page will be leaves (within the page), the "tree of pages" has a splitting factor of pagesize/2.

Parent Function

In contrast to the classic array-like layout, the parent function in a B-heap is more complex because the index of a node's parent must be computed differently depending on where in the page it is. Assuming the positions inside a page are labelled from 0 to pagesize, the parent function can be as follows.

For nodes 0 and 1, these are only used in the variant which is exploiting all possible space. In this case, the parent index of both nodes is the same, it is in a different page, and its specific offset within that page only depends on the current page number. Specifically, to compute the parent's page number, simply divide the current node's page number by the "page tree's" splitting factor, which is pagesize/2. To get the right offset within the page, consider that it must be one of the leaf nodes within the parent page, so start at offset pagesize/2. Then add the difference between the current page number, and the parent's page number, minus one since the first page after the parent page has its parent node in index (pagesize/2).

For nodes 2 and 3, the parent is different depending on the mode. In space-saving mode, the parents are simply the nodes 0 and 1, respectively, so one needs only to subtract with 2. On the other hand, in strict-binary-tree-mode, these nodes are the roots of the page instead of 0 and 1, and so their common parent is computed the same way as described above.

For all other nodes, their parent will be within the same page, and it is enough to divide their offset within their page by 2, not changing the page number.

See also

References

  1. ^ Kamp, Poul-Henning (2020-07-26). "You're Doing It Wrong". ACM Queue.
  2. ^ Naor, Dalit; Martel, Charles U.; Matloff, Norman S. (1991). "Performance of Priority Queue Structures in a Virtual Memory Environment". Comput. J. 34 (5): 428–437. doi:10.1093/comjnl/34.5.428.
  3. ^ van Emde Boas, P.; Kaas, R.; Zijlstra, E. (1976). "Design and implementation of an efficient priority queue". Mathematical Systems Theory. 10: 99–127. doi:10.1007/BF01683268. S2CID 8105468.
  4. ^ Kamp, Poul-Henning. "You're Doing It Wrong". phk.freebsd.dk. Retrieved 2019-06-08.

Read other articles:

LG dan Life's Good dialihkan ke halaman ini. Untuk kegunaan lain, lihat LG (disambiguasi) dan Life Is Good (disambiguasi). Artikel ini memerlukan pemutakhiran informasi. Harap perbarui artikel dengan menambahkan informasi terbaru yang tersedia. LG Corporation주식회사 LGSebelumnyaLucky-Goldstar (1983–1995)JenisPublikKode emitenKRX: 003550IndustriKonglomeratDidirikan5 Januari 1947; 77 tahun lalu (1947-01-05)PendiriKoo In-hwoiKantorpusatSeoul, Korea SelatanWilayah operasiSeluruh dunia...

 

 

Scottish footballer For the novelist, see Lissa Evans. Lisa Evans Evans with West Ham United in 2023Personal informationFull name Lisa Catherine Evans[1]Date of birth (1992-05-21) 21 May 1992 (age 31)[1]Place of birth Perth, ScotlandHeight 1.66 m (5 ft 5 in)[1]Position(s) Winger, Forward, Wing-back, Full backTeam informationCurrent team Bristol City FCNumber 22Youth career St Johnstone Girls[2]Senior career*Years Team Apps (Gls)2008–2012 G...

 

 

Artikel ini bukan mengenai Terminal Taman. Terminal TamananTerminal Penumpang Tipe APapan Nama Terminal TamananLokasiJalan Argo Wilis, Dusun Semen, Desa Semen, Kecamatan Semen, Kabupaten KediriProvinsi Jawa TimurKodepos 64161IndonesiaKoordinat7°49′45″S 111°59′03″E / 7.829086°S 111.984224°E / -7.829086; 111.984224Koordinat: 7°49′45″S 111°59′03″E / 7.829086°S 111.984224°E / -7.829086; 111.984224PemilikPemerintah Kota Kediri...

Neil JordanJordan di Festival Film Tribeca 2010LahirNeil Patrick Jordan25 Februari 1950 (umur 74)Sligo, IrlandiaPekerjaanSutradara, penulis latar, novelisTahun aktif1979–sekarangSuami/istriVivienne ShieldsBrenda Rawn (2004–sekarang)Anak5Situs webneiljordan.com Neil Patrick Jordan (kelahiran 25 Februari 1950) adalah seorang sutradara, penulis latar dan novelis Irlandia. Ia memenangkan sebuah Academy Award (Permainan Latar Asli Terbaik) untuk The Crying Game. Ia juga memenangkan ...

 

 

Institut national de l'origine et de la qualitéLogo de l'InaoHistoireFondation 1935CadreSigle INAOType Agence publique, organisme de formation (depuis 2010)Forme juridique Établissement public national à caractère administratifDomaine d'activité Administration publique (tutelle) des activités économiquesSiège MontreuilPays  FranceOrganisationEffectif 246 agents (2021)Président du Conseil permanent Philippe BrisebarreDirectrice Carole LyOrganisation mère Ministère de l'Agricult...

 

 

These are paintings by the American artist Charles Marion Russell Paintings by Charles Marion Russell Image Title When the Land Belonged to God, 1914 For Supremacy, 1895 (Intertribal warfare among the Blackfeet, Crow, and Sioux) The Tenderfoot, 1900 Smoke of a .45 (A shootout at a saloon) Loops and Swift Horses Are Surer than Lead (Cowboys in Montana catch a bear harassing the herd.) Lewis and Clark on the Lower Columbia Herd Quitters War Council on the Plains To The Victor Belongs The Spoil...

Laksamana Arthur Gerard McDonald, CMM, MSM, CD (lahir 1967)[1] adalah laksamana Angkatan Laut Kerajaan Kanada yang menjabat sebagai Kepala Staf Pertahanan Angkatan Darat Kanada dari 14 Januari 2021 hingga 24 Februari 2021, ketika ia secara sukarela mengundurkan diri karena penyelidikan oleh Layanan Investigasi Nasional Angkatan Darat Kanada. Pada tanggal 25 November 2021, McDonald secara resmi dibebastugaskan dari komandonya, dan digantikan secara permanen oleh Jenderal Wayne Eyre yan...

 

 

  提示:此条目页的主题不是沙巴民族统一机构。   提示:此条目页的主题不是卡达山杜顺人统一机构 (1961)。 此條目可参照英語維基百科相應條目来扩充。若您熟悉来源语言和主题,请协助参考外语维基百科扩充条目。请勿直接提交机械翻译,也不要翻译不可靠、低品质内容。依版权协议,译文需在编辑摘要注明来源,或于讨论页顶部标记{{Translated page}}标签�...

 

 

World Heritage Site and national park in Peru Huascarán National ParkIUCN category II (national park)Mount Huascarán, landmark and namesake of Huascarán National ParkLocationPeruAncashNearest cityHuaraz, AncashCoordinates9°20′0″S 77°24′0″W / 9.33333°S 77.40000°W / -9.33333; -77.40000Area340,000 ha (840,000 acres)Established1 July 1975Governing bodySERNANPWebsiteParque Nacional Huascarán UNESCO World Heritage SiteCriteriaNatural: (vii...

Judgement of the High Court of Australia Codelfa Construction Pty Ltd v State Rail Authority of NSWCourtHigh Court of AustraliaDecided11 May 1982Citations[1982] HCA 24, (1982) 149 CLR 337Case historyAppealed fromNew South Wales Court of AppealSubsequent actions[1982] HCA 51, (1982) 150 CLR 29Case opinions(5:0) There was no implied term dealing with restraint by injunction (4:1) The contract was frustrated because of the injunction(Brennan J dissen...

 

 

Danish zoologist You can help expand this article with text translated from the corresponding article in Danish. (June 2023) Click [show] for important translation instructions. Machine translation, like DeepL or Google Translate, is a useful starting point for translations, but translators must revise errors as necessary and confirm that the translation is accurate, rather than simply copy-pasting machine-translated text into the English Wikipedia. Do not translate text that appears unr...

 

 

1970 compilation album by Jo StaffordBig Band SoundCompilation album by Jo StaffordReleasedJanuary 1, 1970GenreTraditional pop, jazzLabelCorinthian Professional ratingsReview scoresSourceRatingAllmusic[1] Big Band Sound is a 1970 compilation album of standards by Jo Stafford. The songs were recorded between 1960 and 1970 and see Stafford backed by a number of big band arrangers, notably her husband Paul Weston, as well as Billy May and Benny Carter.[2] The album was re...

В Википедии есть статьи о других людях с фамилией Бермас. Виктор Кондратьевич Бермас Дата рождения 28 апреля 1927(1927-04-28) Место рождения Берёзки, Кривоозёрский район, Николаевская область, СССР Дата смерти 9 июля 2008(2008-07-09) (81 год) Место смерти Белая Калитва, Ростовская об�...

 

 

Untuk the poet, lihat Shin Dong-yup (penyair). Ini adalah nama Korea; marganya adalah Shin. Shin Dong-yupLahir17 Februari 1971 (umur 53)SeoulKebangsaanKorea SelatanTahun aktif1991–sekarangSuami/istriSun Hye-yoonNama KoreaHangul신동엽 Hanja申東燁 Alih AksaraSin DongyeopMcCune–ReischauerSin Tongyŏp Shin Dong-yup (Hangul: 신동엽; lahir 17 Februari 1971) adalah pembawa acara komedi televisi dan komedian asal Korea Selatan. Ia lulus dari Seoul Institute of the Arts. Pad...

 

 

Questa voce o sezione deve essere rivista e aggiornata appena possibile. Commento: Testo della voce fermo al 2019 Sembra infatti che questa voce contenga informazioni superate e/o obsolete. Se puoi, contribuisci ad aggiornarla. Partito Laburista IsraelianoMiflèghet ha-'Avodà ha-Yisraelitמפלגת העבודה הישראלית PresidenteYair Golan Stato Israele Fondazione21 gennaio 1968 Derivato da Mapai Rafi IdeologiaSocialdemocraziaSionismo socialistaTerza viaSoluzione dei...

Carl Friedrich von WeizsäckerWeizsäcker pada tahun 1993LahirCarl Friedrich Freiherr von Weizsäcker(1912-06-28)28 Juni 1912Kiel, Provinsi Schleswig-Holstein, Kerajaan JermanMeninggal28 April 2007(2007-04-28) (umur 94)Starnberg, JermanAlmamater Universitas Göttingen Universitas Leipzig Dikenal atas Koreksi Weizsäcker terhadap potensi kuantum Rumus massa semi-empiris Siklus CNO Penghargaan Medali Max Planck (1957) Penghargaan Goethe (1958) Pour le Mérite (1961) Penghargaan Templeton ...

 

 

Canadian-American actor and singer (1925–2016) Bobby BreenBornIsadore Borsuk(1927-11-04)November 4, 1927Montreal, Quebec, CanadaDiedSeptember 19, 2016(2016-09-19) (aged 88)Pompano Beach, Florida, U.S.OccupationsActorsingerYears active1936–2016Spouses Jocelyn Lesh ​ ​(m. 1952; div. 1961)​ Audrey Howard ​ ​(m. 1962)​ Children1 Isadore Borsuk (November 4, 1927 – September 19, 2016), better known as...

 

 

Historic building in Ponce, Puerto Rico United States historic placeAntiguo Hospital Militar Español de PonceU.S. National Register of Historic Places Location of Ponce and the Antiguo Hospital Militar Español in Puerto RicoLocationCalle Bondad, between Calle Atocha and Calle LeónPonce, Puerto RicoCoordinates18°01′08″N 66°36′52″W / 18.019026°N 66.614432°W / 18.019026; -66.614432Area1 acre (4,000 m2)Built1896-97ArchitectSpanish Royal Corps of Enginee...

Fighter in the Cretan Revolution of 1866HegumenGavriil MarinakisGavriil Marinakis (National Historical Museum of Greece).Native nameΓαβριήλ ΜαρινάκηςBornc. 1826Margarites, Rethymno, Crete, Ottoman EmpireDied9 November 1866Arkadi Monastery, Crete, Ottoman Empire (now Greece)BuriedCourtyard of Arkadi MonasteryAllegiance Kingdom of GreeceService/branch Cretan RevolutionariesBattles/warsCretan revolt (1866–1869) Siege of Arkadi Monastery † Gavriil Marinakis (Greek: Γ...

 

 

This article includes a list of references, related reading, or external links, but its sources remain unclear because it lacks inline citations. Please help improve this article by introducing more precise citations. (December 2021) (Learn how and when to remove this message) TallyGenicomIndustryPrintersPredecessorGENICOM, TallyFounded2009SuccessorPrintronix, DASCOM The TallyGenicom brand, acquired by Printronix in 2009, includes laser and line matrix printers, parts, consumables and service...