Tango tree

A tango tree is a type of binary search tree proposed by Erik D. Demaine, Dion Harmon, John Iacono, and Mihai Pătrașcu in 2004.[1] It is named after Buenos Aires, of which the tango is emblematic.

It is an online binary search tree that achieves an competitive ratio relative to the offline optimal binary search tree, while only using additional bits of memory per node. This improved upon the previous best known competitive ratio, which was .

Structure

Tango trees work by partitioning a binary search tree into a set of preferred paths, which are themselves stored in auxiliary trees (so the tango tree is represented as a tree of trees).

Reference tree

To construct a tango tree, we simulate a complete binary search tree called the reference tree, which is simply a traditional binary search tree containing all the elements. This tree never shows up in the actual implementation, but is the conceptual basis behind the following pieces of a tango tree.

In particular, the height of the reference tree is ⌈log2(n+1)⌉. This equals the length of the longest path, and therefore the size of the largest auxiliary tree. By keeping the auxiliary trees reasonably balanced, the height of the auxiliary trees can be bounded to O(log log n). This is the source of the algorithm's performance guarantees.

Preferred paths

The preferred paths of a tree. Each node's preferred child is its most recently visited child.

First, we define for each node its preferred child, which informally is the most-recently visited child by a traditional binary search tree lookup. More formally, consider a subtree T, rooted at p, with children l (left) and r (right). We set r as the preferred child of p if the most recently accessed node in T is in the subtree rooted at r, and l as the preferred child otherwise. Note that if the most recently accessed node of T is p itself, then l is the preferred child by definition.

A preferred path is defined by starting at the root and following the preferred children until reaching a leaf node. Removing the nodes on this path partitions the remainder of the tree into a number of subtrees, and we recurse on each subtree (forming a preferred path from its root, which partitions the subtree into more subtrees).

Auxiliary trees

To represent a preferred path, we store its nodes in a balanced binary search tree, specifically a red–black tree. For each non-leaf node n in a preferred path P, it has a non-preferred child c, which is the root of a new auxiliary tree. We attach this other auxiliary tree's root (c) to n in P, thus linking the auxiliary trees together. We also augment the auxiliary tree by storing at each node the minimum and maximum depth (depth in the reference tree, that is) of nodes in the subtree under that node.

Algorithm

Searching

To search for an element in the tango tree, we simply simulate searching the reference tree. We start by searching the preferred path connected to the root, which is simulated by searching the auxiliary tree corresponding to that preferred path. If the auxiliary tree doesn't contain the desired element, the search terminates on the parent of the root of the subtree containing the desired element (the beginning of another preferred path), so we simply proceed by searching the auxiliary tree for that preferred path, and so forth.

Updating

In order to maintain the structure of the tango tree (auxiliary trees correspond to preferred paths), we must do some updating work whenever preferred children change as a result of searches. When a preferred child changes, the top part of a preferred path becomes detached from the bottom part (which becomes its own preferred path) and reattached to another preferred path (which becomes the new bottom part). In order to do this efficiently, we'll define cut and join operations on our auxiliary trees.

Join

Our join operation will combine two auxiliary trees as long as they have the property that the top node of one (in the reference tree) is a child of the bottom node of the other (essentially, that the corresponding preferred paths can be concatenated). This will work based on the concatenate operation of red–black trees, which combines two trees as long as they have the property that all elements of one are less than all elements of the other, and split, which does the reverse. In the reference tree, note that there exist two nodes in the top path such that a node is in the bottom path if and only if its key-value is between them. Now, to join the bottom path to the top path, we simply split the top path between those two nodes, then concatenate the two resulting auxiliary trees on either side of the bottom path's auxiliary tree, and we have our final, joined auxiliary tree.

Cut

Our cut operation will break a preferred path into two parts at a given node, a top part and a bottom part. More formally, it'll partition an auxiliary tree into two auxiliary trees, such that one contains all nodes at or above a certain depth in the reference tree, and the other contains all nodes below that depth. As in join, note that the top part has two nodes that bracket the bottom part. Thus, we can simply split on each of these two nodes to divide the path into three parts, then concatenate the two outer ones so we end up with two parts, the top and bottom, as desired.

Analysis

In order to bound the competitive ratio for tango trees, we must find a lower bound on the performance of the optimal offline tree that we use as a benchmark. Once we find an upper bound on the performance of the tango tree, we can divide them to bound the competitive ratio.

Interleave bound

To find a lower bound on the work done by the optimal offline binary search tree, we again use the notion of preferred children. When considering an access sequence (a sequence of searches), we keep track of how many times a reference tree node's preferred child switches. The total number of switches (summed over all nodes) gives an asymptotic lower bound on the work done by any binary search tree algorithm on the given access sequence. This is called the interleave lower bound.[1]

Tango tree

In order to connect this to tango trees, we will find an upper bound on the work done by the tango tree for a given access sequence. Our upper bound will be , where k is the number of interleaves.

The total cost is divided into two parts, searching for the element, and updating the structure of the tango tree to maintain the proper invariants (switching preferred children and re-arranging preferred paths).

Searching

To see that the searching (not updating) fits in this bound, simply note that every time an auxiliary tree search is unsuccessful and we have to move to the next auxiliary tree, that results in a preferred child switch (since the parent preferred path now switches directions to join the child preferred path). Since all auxiliary tree searches are unsuccessful except the last one (we stop once a search is successful, naturally), we search auxiliary trees. Each search takes , because an auxiliary tree's size is bounded by , the height of the reference tree.

Updating

The update cost fits within this bound as well, because we only have to perform one cut and one join for every visited auxiliary tree. A single cut or join operation takes only a constant number of searches, splits, and concatenates, each of which takes logarithmic time in the size of the auxiliary tree, so our update cost is .

Competitive ratio

Tango trees are -competitive, because the work done by the optimal offline binary search tree is at least linear in k (the total number of preferred child switches), and the work done by the tango tree is at most .

See also

References

  1. ^ a b Demaine, E. D.; Harmon, D.; Iacono, J.; Pătraşcu, M. (2007). "Dynamic Optimality—Almost" (PDF). SIAM Journal on Computing. 37 (1): 240. doi:10.1137/S0097539705447347.

Read other articles:

Djezzar beralih ke halaman ini. Untuk komune di Aljazair, lihat Djezzar, Aljazair. Ahmad Pasha al-JazzarPotret Jazzar Pasha, 1775 Wali SidonMasa jabatanMei 1777 – April 1804Penguasa monarkiAbdul Hamid I Selim III PendahuluZahir al-UmarPenggantiSulayman Pasha al-AdilWali DamaskusMasa jabatanMaret 1785 – 1786Penguasa monarkiAbdul Hamid I PendahuluHusayn Pasha BattalPenggantiPetahanaMasa jabatanOktober 1790 – 1795Penguasa monarkiSelim III PendahuluIbrahim Deli Pa...

 

 

American crime film The UnderneathTheatrical release posterDirected bySteven SoderberghScreenplay bySam Lowry Daniel FuchsBased onCriss Crossby Don TracyProduced byJohn HardyStarring Peter Gallagher Alison Elliott William Fichtner Adam Trese Joe Don Baker Paul Dooley Shelley Duvall Elisabeth Shue CinematographyElliot DavisEdited byStan SalfasMusic byCliff MartinezDistributed byGramercy PicturesRelease date April 28, 1995 (1995-04-28) Running time99 minutesCountryUnited StatesLa...

 

 

PausSergius IVAwal masa kepausan31 Juli 1009Akhir masa kepausan12 Mei 1012PendahuluYohanes XVIIIPenerusBenediktus VIIIInformasi pribadiNama lahirPietro Martino BoccapecoraLahirtanggal tidak diketahuiRoma, ItaliaWafat12 Mei 1012Roma, ItaliaPaus lainnya yang bernama Sergius Paus Sergius IV, nama lahir Pietro Martino Boccapecora (???-12 Mei 1012), adalah Paus Gereja Katolik Roma sejak 31 Juli 1009 hingga 12 Mei 1012. Didahului oleh:Yohanes XVIII Paus1009 – 1012 Diteruskan oleh:Benediktus ...

Artikel ini membutuhkan rujukan tambahan agar kualitasnya dapat dipastikan. Mohon bantu kami mengembangkan artikel ini dengan cara menambahkan rujukan ke sumber tepercaya. Pernyataan tak bersumber bisa saja dipertentangkan dan dihapus.Cari sumber: Grand Theft Auto: Vice City – berita · surat kabar · buku · cendekiawan · JSTOR (Oktober 2023)Grand Theft Auto: Vice City Publikasi29 Oktober 2002GenreAksiKarakterKen Rosenberg (en), Lance Vance (en), Mr. Bla...

 

 

Silvius In Roman mythology, Silvius (Latin: Silvǐus; Ancient Greek: Σιλούιος, also spelled Sylvius)[1] or Silvius Postumus,[2][3] was either the son of Aeneas and Lavinia or the son of Ascanius. He succeeded Ascanius as King of Alba Longa[4] and reigned 1139–1110 BC.[1] According to the former tradition, upon the death of Aeneas, Lavinia is said to have hidden in a forest from the fear that Ascanius would harm the child. He was named after hi...

 

 

温贝托·德·阿连卡尔·卡斯特洛·布兰科Humberto de Alencar Castelo Branco第26任巴西總統任期1964年4月15日—1967年3月15日副总统若澤·馬利亞·奥克明前任拉涅里·馬齐利继任阿图尔·达科斯塔·伊·席尔瓦 个人资料出生(1897-09-20)1897年9月20日 巴西塞阿腊州福塔雷萨逝世1967年7月18日(1967歲—07—18)(69歲) 巴西塞阿腊州梅塞雅納墓地 巴西福塔雷薩卡斯特洛·布兰科陵寢[1]...

Admiration for the United States This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Pro-Americanism – news · newspapers · books · scholar · JSTOR (July 2023) (Learn how and when to remove this message) Look up Americophilia in Wiktionary, the free dictionary. Pro-Americanism (also called pro-American sentiment ...

 

 

Lost opera by Scott Joplin 1903 Advertising poster for A Guest of Honor by Scott Joplin A Guest of Honor (ISJ 54)[1] is the first opera created by celebrated ragtime composer Scott Joplin. The opera had two acts, followed the model of grand opera,[2] and followed the events surrounding the 1901 White House dinner hosted by President Theodore Roosevelt for the civil rights leader and educator Booker T. Washington.[3] History Joplin is believed to have begun writing A Gu...

 

 

Town in Indiana, United StatesClarksville, IndianaTownClarksville Town Hall FlagLocation of Clarksville in Clark County, Indiana.Coordinates: 38°21′02″N 85°46′02″W / 38.35056°N 85.76722°W / 38.35056; -85.76722CountryUnited StatesStateIndianaCountyClarkTownshipsSilver Creek, JeffersonvilleGovernment • TypeTown Council • PresidentRyan Ramsey[citation needed]Area[1] • Total10.23 sq mi (26.51 k...

البطولات الوطنية الأمريكية 1938 رقم الفعالية 58  البلد الولايات المتحدة  التاريخ 1938  الرياضة كرة المضرب  البطولات الوطنية الأمريكية 1937  البطولات الوطنية الأمريكية 1939  تعديل مصدري - تعديل   يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير ه�...

 

 

Politics of Canada Government (structure) The Crown Monarch (list): Charles III Governor General (list): Mary Simon Monarchy in the provinces Lieutenant governors Royal prerogative Executive King’s Privy Council Prime minister (List of prime ministers): Justin Trudeau Cabinet (List of Canadian ministries): 29th Canadian Ministry President of the Privy Council Clerk of the Privy Council Privy Council Office Public Service Provincial and territorial executive councils Premiers Legislative Fe...

 

 

Irish sports promoter and criminal figure For the Ulster Unionist politician, see Danny Kinahan. Daniel KinahanBorn (1977-06-25) 25 June 1977 (age 47)Dublin, IrelandOccupationBoxing promoterRelativesChristy Kinahan (father)Christopher Kinahan Junior (brother)Reward amount$5 millionWanted byGarda SíochánaNCADEAWanted since12 April 2022 Daniel Joseph Kinahan (born 25 June 1977) is an Irish boxing promoter and suspected crime boss. He has been named by the High Court of Ireland ...

Head of state and government of Senegal President of theRepublic of SenegalPrésident de laRépublique du SénégalCoat of Arms of SenegalIncumbentBassirou Diomaye Fayesince 2 April 2024ResidencePalace of the RepublicTerm length5 years, renewable onceInaugural holderLéopold Sédar SenghorFormation6 September 1960Salary9,278,556 West African CFA francs annually[1]Websitepresidence.sn Politics of Senegal Constitution Human rights Government President Macky Sall Prime Minister Sidi...

 

 

Reaksi aldol adalah salah satu reaksi pembentukan ikatan karbon-karbon yang penting dalam kimia organik.[1][2][3] Dalam bentuk yang umum, ia melibatkan adisi nukleofilik enolat keton ke sebuah aldehida, membentuk sebuah keton β-hidroksi, atau aldol (aldehida + alkohol), sebuah struktur senyawa obat-obatan yang ditemukan secara alami .[4][5][6] Kadang-kadang, produk adisi aldol melepaskan sebuah molekul air selama reaksi dan membentuk keton α,�...

 

 

Aeropuerto de Ålesund-Vigra Ålesund lufthavn, Vigra IATA: AES OACI: ENAL FAA: LocalizaciónUbicación Vigra, Møre og Romsdal, NoruegaElevación 21Sirve a Ålesund Noruega NoruegaDetalles del aeropuertoTipo PúblicoOperador AvinorEstadísticas (2013)Pasajeros 1 077 209Operaciones 16 057Carga (toneladas) 641Pistas DirecciónLargoSuperficie07/252314AsfaltoMapa AES/ENAL Posición del aeropuerto en NoruegaSitio web www.avinor.no/flyplass/alesund Fuente: AIP de Noruega y AvinorEst...

Guinean writer and educator who invented the N'Ko alphabet Solomana Kante (left) and Baba Mamadi Diane (right) Map of the life of Sulemaana Kante, inventor of the N'ko alphabet Grave of Solomana Kanté Solomana Kanté (also written as Sùlemáana Kántε,[1] Souleymane Kanté or Sulemaana Kantè; N'Ko: ߛߎ߬ߟߋ߬ߡߊ߬ߣߊ߬ ߞߊ߲ߕߍ߫, 1922 – November 23, 1987) was a Guinean writer, neographer, and educator,[2] best known as the inventor of the N'Ko alphabet for the Man...

 

 

Dieser Artikel beschreibt die Blütenform. Zur Form des tierischen Körpers siehe dorsiventral. Gundermann (Glechoma hederacea), zygomorphe Blüte von vorne Als zygomorph (von griechisch ζυγόν zygon „(Ochsen-)Joch“ und μορφή morphé „Form“) werden in der Botanik Blüten bezeichnet, die aus zwei spiegelsymmetrischen Hälften (bilaterale Symmetrie), aber unterschiedlichen Ober- und Unterseiten bestehen, also über nur eine Symmetrieebene (Monosymmetrie) verfügen. Bei Blätte...

 

 

Virgilio SpigaiL'Ammiraglio SpigaiNascitaLa Spezia, 24 settembre 1907 MorteRoma, 30 luglio 1976 Dati militariPaese servito Italia Italia Forza armata Regia Marina Marina Militare Anni di servizio1923 - 1970 GradoAmmiraglio Guerreseconda guerra mondiale Comandante disommergibile Ametistacorazzata Vittorio Veneto1ª Squadriglia Torpediniere5ª Squadriglia TorpediniereIstituto di Guerra MarittimoI Divisione navale DecorazioniCavaliere OMI Biografia sul sito della M...

Right of people to travel within and outside of their own country This article is about the right to travel. For the mechanical concept, see Range of motion. Free movement of persons redirects here. For the freedom of movement within the European Union, see Freedom of movement for workers in the European Union and European Single Market. Freedom of movement, mobility rights, or the right to travel is a human rights concept encompassing the right of individuals to travel from place to place wi...

 

 

Disambiguazione – Salvatores rimanda qui. Se stai cercando il cognome italiano, vedi Salvatori (cognome). Gabriele Salvatores nel 2014 Gabriele Salvatores (Napoli, 30 luglio 1950) è un regista e sceneggiatore italiano. Il suo film Mediterraneo ha ricevuto l'Oscar al miglior film in lingua straniera nel 1992. È uno dei fondatori, insieme a Maurizio Totti e Diego Abatantuono, della casa di produzione cinematografica Colorado Film e dei vari progetti associati dell'azienda, come ad ...