Share to: share facebook share twitter share wa share telegram print page

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:

Arirang TVDiluncurkan3 Februari 1997; 26 tahun lalu (1997-02-03)PemilikKorea International Broadcasting FoundationSloganThe World On ArirangNegaraKorea SelatanBahasaInggris, Tionghoa, Spanyol, Arab, Rusia, Vietnam, IndonesiaKantor pusatSeoul, Korea SelatanSitus webwww.arirang.co.kr Untuk penggunaan lain, lihat Arirang Arirang TV (Korea: 아리랑 TV) adalah stasiun televisi internasional berbahasa Inggris yang berlokasi di Seoul, Korea Selatan. Arirang TV dioperasikan oleh Lembaga Penyiaran…

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (أكتوبر 2023) هذه مقالة غير مراجعة. ينبغي أن يزال هذا القالب بعد أن يراجعها محرر مغاير للذي أنشأها؛ إذا لزم الأمر فيجب أن توسم المقالة بقوالب الصيانة المناسبة. يمكن أيضاً ت

Шарль-Амеде де Брольифр. Charles Amédée de Broglie Губернатор Конде 1702 — 1707 Рождение 1649(1649) Смерть 25 октября 1707(1707-10-25) Род Брольи Отец Франсуа-Мари де Брольи Мать Олимпа-Катрин де Вассаль Награды Военная служба Годы службы 1665—1703 Принадлежность  Королевство Франция Звание ген…

American record label This article is about record label. For the first commercial television network in Indonesia, see RCTI. CTI RecordsFounded1967 (1967)FounderCreed TaylorDistributor(s)Sony (US), King Records (Japan)GenreJazzCountry of originU.S.LocationNew York City CTI Records (Creed Taylor Incorporated) is a jazz record label founded in 1967 by Creed Taylor. CTI was a subsidiary of A&M before becoming independent in 1970. Its first album was A Day in the Life by guitarist Wes Mont…

Pour les articles homonymes, voir Trevor Smith (homonymie) et Smith. Busta RhymesBiographieNaissance 20 mai 1972 (51 ans)East Flatbush (en)Nom de naissance Trevor George Smith Jr.Pseudonyme Busta RhymesNationalité américaineFormation George Westinghouse Career and Technical Education High School (en)Samuel J. Tilden High School (en)Uniondale High School (en)Activités Rappeur, acteur, producteur de disques, chanteur, auteur-compositeur, producteur de musiquePériode d'activité depuis 198…

?Murina loreliae Охоронний статус Недосліджений (МСОП 3.1) Біологічна класифікація Домен: Еукаріоти (Eukaryota) Царство: Тварини (Animalia) Тип: Хордові (Chordata) Клас: Ссавці (Mammalia) Ряд: Рукокрилі (Chiroptera) Родина: Лиликові (Vespertilionidae) Рід: Murina Вид: Murina loreliaeEger & Lim, 2011 Посилання Віківиди: Murina loreliae ITI…

Autodromo nazionale di MonzaTracciato di Autodromo nazionale di MonzaLocalizzazioneStato Italia LocalitàMonza CaratteristicheLunghezza5 793[1] m Curve11 Inaugurazione1922 CategorieFormula 1 Superbike FIA WEC Altre serieFormula 2, Formula 3, DTM, Campionati ACI CSAI, SRO e molte altre categorie di ogni genere. Formula 1Tempo record1'21046[1] Stabilito daRubens Barrichello suFerrari F2004 il12 settembre 2004 record in gara SuperbikeTempo record1'42229[2] Stabilito daT…

Artikel ini bukan mengenai Nusantara TV. RTV Cikarang[1]PT Nusantara TelevisiCikarang, Kabupaten Bekasi, Jawa BaratIndonesiaSaluranDigital: 26 UHFVirtual: 32BrandingRTVRTV Cikarang (alternatif)SloganMakin CakepPemrogramanAfiliasiRTV (stasiun induk)KepemilikanPemilik Sofia Koswara (2008–2012) Rajawali Corpora (2008–sekarang) RiwayatDidirikan2005Siaran perdana30 Desember 2008 (siaran percobaan)1 November 2009 (sebagai TVN)3 Mei 2014 (sebagai RTV Cikarang)Bekas tanda panggilTVN (2008–…

كارليسل     الإحداثيات 39°34′47″N 84°19′09″W / 39.5797°N 84.3192°W / 39.5797; -84.3192  تقسيم إداري  البلد الولايات المتحدة[1]  التقسيم الأعلى أوهايو  خصائص جغرافية  المساحة 9660655 متر مربع9.667299 كيلومتر مربع (1 أبريل 2010)  ارتفاع 213 متر  عدد السكان  عدد السكان 4915…

Contoh satu ruas garis Tiga garis — garis merah dan biru memiliki kemiringan yang sama, sementara garis merah dan hijau memiliki persilangan y yang sama. Garis (bahasa Inggris: line), dalam geometri Euklides, adalah sebuah lengkungan lurus. Ketika geometri digunakan untuk memodel dunia nyata, garis digunakan untuk menggambarkan objek lurus dengan lebar dan tinggi yang berbeda. Garis adalah idealisasi dari objek semacam itu dan tidak punya lebar atau tinggi dan panjangnya dianggap tak hingg…

Former unrecognized state in British-ruled Iraq Kingdom of KurdistanKeyaniya Kurdistanê شانشینی کوردستان1921–1924/1925 FlagStatusUnrecognized stateCapitalSulaymaniyahCommon languagesKurdishReligion Sunni Islam (Specifically Qadiriyya Sufi Order)GovernmentMonarchy• Malik[1] Mahmud Barzanji• Prime Minister Qadir Barzanji Historical eraInterwar period• Treaty of Sèvres 10 August 1920• Proclaimed September 1921• Treaty of Lausanne 24…

Pandangan atas dan samping transmisi manual yang ditempatkan dilantai dari Ford dengan 4 kecepatan Transmisi manual adalah tipe transmisi yang digunakan pada kendaraan bermotor. Sistem ini menggunakan kopling yang dioperasikan oleh pengemudi untuk mengatur perpindahan torsi dari mesin menuju transmisi, serta pemindah gigi yang dioperasikan dengan tangan (pada mobil) atau kaki (pada motor). Gigi percepatan dirangkai di dalam kotak gigi/gerbox untuk beberapa kecepatan, biasanya berkisar antara 3 s…

Richard P. Binzel Richard P. Binzel adalah seorang profesor di Department of Earth, Atmospheric, and Planetary Sciences, Institut Teknologi Massachusetts. Merupakan salah satu astronomer terkemuka di dunia yang mempelajari Pluto dan asteroid, Binzel mempublikasikan makalah sains pertamanya pada usia 15 tahun, menyelesaikan gelar kesarjanaannya dalam jurusan Fisika di Macalester College dan menerima gelar Ph.D di bidang astronomi dari Universitas Texas. Pada tahun 1985 sampai 1990 Binzel bekerja …

جزيرة الأمير باتريك   أصل التسمية الأمير آرثر دوق كونوت وستراذرن  تاريخ الاكتشاف 1853  معلومات جغرافية   المنطقة جزر كوين إليزابيث  الإحداثيات 76°45′N 119°30′W / 76.75°N 119.5°W / 76.75; -119.5  [1] [2] الأرخبيل أرخبيل القطب الشمالي الكندي  المسطح المائي الم…

Британський морський освітлювальний снаряд зразка 1943 року Освітлювальні снаряди випущені з гаубиці М777 під час операції в провінції Кандагар, Афганістан, в 2009 р. Осві́тлювальний снаря́д — вид спеціальних артилерійських снарядів (міна), призначений для освітлення ціле

John H. WagemanLahir(1841-03-22)22 Maret 1841Amelia, OhioMeninggal9 Januari 1916(1916-01-09) (umur 74)Tempat pemakamanWilliamsburg, OhioPengabdianAmerika SerikatDinas/cabangAngkatan Darat Amerika SerikatUnion ArmyPangkatPrivatKesatuanInfanteri Ohio ke-60Perang/pertempuranPertempuran Petersburg KeduaPenghargaan Medal of Honor John H. Wageman (22 Maret 1841 – 9 Januari 1916) adalah seorang prajurit Amerika Serikat. Ia berjuang untuk Union Army pada Perang Saudara Amerika. Ia m…

De Allianz Arena in München, gaststad op het WK 2006. Supporters van de club 1. FC Union Berlin. Voetbal is een nationale sport in Duitsland. De Duitse voetbalbond (DFB) is het overkoepelende sportortgaan en telt 6,6 miljoen leden verdeeld over ongeveer 26.000 clubs. De competitie is verdeeld in meerdere klassen waarvan de Bundesliga de hoogste is. De winnaar wordt gekroond tot Duits landskampioen. Naast de reguliere competitie zijn er nog enkele bekercompetities waarvan de DFB-Pokal en de supe…

متحف الشارقة للحضارة الإسلامية   إحداثيات 25°21′54″N 55°23′21″E / 25.364916°N 55.389221°E / 25.364916; 55.389221  معلومات عامة نوع المبنى أثري القرية أو المدينة الشارقة الدولة  الإمارات العربية المتحدة سنة التأسيس 2008  معلومات أخرى الموقع الإلكتروني الموقع الرسمي  تعديل مص…

Public research university in Moscow, Russia M. V. LomonosovMoscow State UniversityМосковский государственный университет имени М. В. ЛомоносоваCoat of armsLatin: Universitas MoscuensisMottoНаука есть ясное познание истины, просвещение разумаMotto in EnglishScience is clear knowledge of the truth, enlightenment of the mind Scientia est clara cognitio veritatis, illustratio mentis (Latin)TypePub…

American comic book writer Marv WolfmanWolfman at the 2023 WonderConBornMarvin Arthur Wolfman (1946-05-13) May 13, 1946 (age 77)Brooklyn, New York City, U.S.NationalityAmericanArea(s)Writer, EditorNotable worksThe Tomb of DraculaBladeThe Amazing Spider-ManDaredevilNovaThe New Teen TitansCrisis on Infinite EarthsAdventures of SupermanNightwingAwardsShazam Award, 1973Inkpot Award, 1979Eagle Award, 1982, 1984Jack Kirby Award, 1985 and 1986Scribe Award, 2007National Jewish Book Award, 2008Spous…

Kembali kehalaman sebelumnya

Lokasi Pengunjung: 18.116.88.178