<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Binary-Heap on rustbites</title><link>https://www.rustbites.com/tags/binary-heap/</link><description>Recent content in Binary-Heap on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sat, 16 May 2026 10:37:46 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/binary-heap/index.xml" rel="self" type="application/rss+xml"/><item><title>141. BinaryHeap::into_sorted_vec — Heapsort in One Call</title><link>https://www.rustbites.com/posts/bite-141/</link><pubDate>Fri, 15 May 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-141/</guid><description>&lt;p&gt;You stuffed everything into a &lt;code&gt;BinaryHeap&lt;/code&gt; to keep &amp;ldquo;biggest first&amp;rdquo; cheap, but at the end of the day you want a &lt;em&gt;sorted&lt;/em&gt; &lt;code&gt;Vec&lt;/code&gt; to hand to the next stage. The pop-loop you almost wrote is built into the type — &lt;code&gt;into_sorted_vec&lt;/code&gt; consumes the heap and gives you the ascending-order &lt;code&gt;Vec&lt;/code&gt; for free.&lt;/p&gt;</description></item></channel></rss>