Skip to content

Commit 2a2596e

Browse files
1 parent d562e67 commit 2a2596e

File tree

7 files changed

+189
-173
lines changed

7 files changed

+189
-173
lines changed

main/data_structures/treap.html

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6665,6 +6665,18 @@
66656665

66666666

66676667

6668+
6669+
6670+
6671+
6672+
6673+
6674+
6675+
6676+
6677+
6678+
6679+
66686680

66696681

66706682

@@ -6779,6 +6791,10 @@
67796791

67806792

67816793

6794+
6795+
6796+
6797+
67826798

67836799

67846800

@@ -6791,7 +6807,7 @@
67916807
<ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr">
67926808

67936809
Last update:
6794-
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="June 8, 2022 10:46:05 UTC">June 8, 2022</span>&emsp;
6810+
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="July 3, 2025 15:57:46 UTC">July 3, 2025</span>&emsp;
67956811

67966812
<!-- Tags -->
67976813

@@ -6884,7 +6900,7 @@ <h3 id="erase">Erase<a class="headerlink" href="#erase" title="Permanent link">&
68846900
<img src="https://upload.wikimedia.org/wikipedia/commons/6/62/Treap_erase.svg" width="500px"/>
68856901
</center>
68866902

6887-
<p>Implementation of <strong>Erase (<span class="arithmatex">$X$</span>)</strong> is also clear. First we descend in the tree (as in a regular binary search tree by <span class="arithmatex">$X$</span>), looking for the element we want to delete. Once the node is found, we call <strong>Merge</strong> on it children and put the return value of the operation in the place of the element we're deleting.</p>
6903+
<p>Implementation of <strong>Erase (<span class="arithmatex">$X$</span>)</strong> is also clear. First we descend in the tree (as in a regular binary search tree by <span class="arithmatex">$X$</span>), looking for the element we want to delete. Once the node is found, we call <strong>Merge</strong> on its children and put the return value of the operation in the place of the element we're deleting.</p>
68886904
<p>Alternatively, we can factor out the subtree holding <span class="arithmatex">$X$</span> with <span class="arithmatex">$2$</span> split operations and merge the remaining treaps (see the picture).</p>
68896905
<h3 id="build">Build<a class="headerlink" href="#build" title="Permanent link">&para;</a></h3>
68906906
<p>We implement <strong>Build</strong> operation with <span class="arithmatex">$O (N \log N)$</span> complexity using <span class="arithmatex">$N$</span> <strong>Insert</strong> calls.</p>
@@ -7185,7 +7201,7 @@ <h2 id="practice-problems">Practice Problems<a class="headerlink" href="#practic
71857201

71867202
<ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr">
71877203
<span class="contributors-text">Contributors:</span>
7188-
<ul class="contributors" data-bi-name="contributors"><li><a href="https://github.com/Leefrost" title="Leefrost" data-bi-name="contributorprofile" target="_blank">Leefrost</a> (41.84%)</li><li><a href="https://github.com/adamant-pwn" title="adamant-pwn" data-bi-name="contributorprofile" target="_blank">adamant-pwn</a> (28.28%)</li><li><a href="https://github.com/tcNickolas" title="tcNickolas" data-bi-name="contributorprofile" target="_blank">tcNickolas</a> (8.97%)</li><li><a href="https://github.com/GaurangTandon" title="GaurangTandon" data-bi-name="contributorprofile" target="_blank">GaurangTandon</a> (7.36%)</li><li><a href="https://github.com/meooow25" title="meooow25" data-bi-name="contributorprofile" target="_blank">meooow25</a> (6.44%)</li><li><a href="https://github.com/Morass" title="Morass" data-bi-name="contributorprofile" target="_blank">Morass</a> (3.22%)</li><li><a href="https://github.com/Dalgerok" title="Dalgerok" data-bi-name="contributorprofile" target="_blank">Dalgerok</a> (1.38%)</li><li><a href="https://github.com/jakobkogler" title="jakobkogler" data-bi-name="contributorprofile" target="_blank">jakobkogler</a> (0.92%)</li><li><a href="https://github.com/algmyr" title="algmyr" data-bi-name="contributorprofile" target="_blank">algmyr</a> (0.92%)</li><li><a href="https://github.com/princezna" title="princezna" data-bi-name="contributorprofile" target="_blank">princezna</a> (0.46%)</li><li><a href="https://github.com/kroist" title="kroist" data-bi-name="contributorprofile" target="_blank">kroist</a> (0.23%)</li></ul>
7204+
<ul class="contributors" data-bi-name="contributors"><li><a href="https://github.com/Leefrost" title="Leefrost" data-bi-name="contributorprofile" target="_blank">Leefrost</a> (41.84%)</li><li><a href="https://github.com/adamant-pwn" title="adamant-pwn" data-bi-name="contributorprofile" target="_blank">adamant-pwn</a> (28.05%)</li><li><a href="https://github.com/tcNickolas" title="tcNickolas" data-bi-name="contributorprofile" target="_blank">tcNickolas</a> (8.97%)</li><li><a href="https://github.com/GaurangTandon" title="GaurangTandon" data-bi-name="contributorprofile" target="_blank">GaurangTandon</a> (7.36%)</li><li><a href="https://github.com/meooow25" title="meooow25" data-bi-name="contributorprofile" target="_blank">meooow25</a> (6.44%)</li><li><a href="https://github.com/Morass" title="Morass" data-bi-name="contributorprofile" target="_blank">Morass</a> (3.22%)</li><li><a href="https://github.com/Dalgerok" title="Dalgerok" data-bi-name="contributorprofile" target="_blank">Dalgerok</a> (1.38%)</li><li><a href="https://github.com/jakobkogler" title="jakobkogler" data-bi-name="contributorprofile" target="_blank">jakobkogler</a> (0.92%)</li><li><a href="https://github.com/algmyr" title="algmyr" data-bi-name="contributorprofile" target="_blank">algmyr</a> (0.92%)</li><li><a href="https://github.com/princezna" title="princezna" data-bi-name="contributorprofile" target="_blank">princezna</a> (0.46%)</li><li><a href="https://github.com/yousvf" title="yousvf" data-bi-name="contributorprofile" target="_blank">yousvf</a> (0.23%)</li><li><a href="https://github.com/kroist" title="kroist" data-bi-name="contributorprofile" target="_blank">kroist</a> (0.23%)</li></ul>
71897205
</ul>
71907206

71917207
</article>

main/feed_json_updated.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

main/feed_rss_created.xml

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

main/feed_rss_updated.xml

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

main/search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy