|
6665 | 6665 |
|
6666 | 6666 |
|
6667 | 6667 |
|
| 6668 | + |
| 6669 | + |
| 6670 | + |
| 6671 | + |
| 6672 | + |
| 6673 | + |
| 6674 | + |
| 6675 | + |
| 6676 | + |
| 6677 | + |
| 6678 | + |
| 6679 | + |
6668 | 6680 |
|
6669 | 6681 |
|
6670 | 6682 |
|
|
6779 | 6791 |
|
6780 | 6792 |
|
6781 | 6793 |
|
| 6794 | + |
| 6795 | + |
| 6796 | + |
| 6797 | + |
6782 | 6798 |
|
6783 | 6799 |
|
6784 | 6800 |
|
|
6791 | 6807 | <ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr">
|
6792 | 6808 |
|
6793 | 6809 | 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>  |
| 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>  |
6795 | 6811 |
|
6796 | 6812 | <!-- Tags -->
|
6797 | 6813 |
|
@@ -6884,7 +6900,7 @@ <h3 id="erase">Erase<a class="headerlink" href="#erase" title="Permanent link">&
|
6884 | 6900 | <img src="https://upload.wikimedia.org/wikipedia/commons/6/62/Treap_erase.svg" width="500px"/>
|
6885 | 6901 | </center>
|
6886 | 6902 |
|
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> |
6888 | 6904 | <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>
|
6889 | 6905 | <h3 id="build">Build<a class="headerlink" href="#build" title="Permanent link">¶</a></h3>
|
6890 | 6906 | <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
|
7185 | 7201 |
|
7186 | 7202 | <ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr">
|
7187 | 7203 | <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> |
7189 | 7205 | </ul>
|
7190 | 7206 |
|
7191 | 7207 | </article>
|
|
0 commit comments