fix(styling)

This commit is contained in:
Barrett Ruth 2024-11-29 21:53:04 -06:00
parent ed83255604
commit 5ce278c8fa
2 changed files with 20 additions and 25 deletions

View file

@ -51,23 +51,19 @@
<p>Design a data structure supporting the following operations:</p> <p>Design a data structure supporting the following operations:</p>
<ul> <ul>
<li> <li>
<span class="inline-code" <span><code>build(size_t capacity)</code></span>
><code>build(size_t capacity)</code></span
>
: initialize the data structure with capacity/window size : initialize the data structure with capacity/window size
<span class="inline-code"><code>capacity</code></span> <span><code>capacity</code></span>
</li> </li>
<ul> <ul>
<li> <li>
The data structure must always hold \(\leq\) The data structure must always hold \(\leq\)
<span class="inline-code"><code>capacity</code></span> <span><code>capacity</code></span>
prices. prices.
</li> </li>
</ul> </ul>
<li> <li>
<span class="inline-code" <span><code>void push_back(double value)</code></span>
><code>void push_back(double value)</code></span
>
</li> </li>
<ul> <ul>
<li> <li>
@ -76,15 +72,15 @@
</li> </li>
</ul> </ul>
<li> <li>
<span class="inline-code"><code>void pop_front()</code></span> <span><code>void pop_front()</code></span>
: remove the price from the front of the window : remove the price from the front of the window
</li> </li>
<li> <li>
<span class="inline-code"><code>size_t size()</code></span> <span><code>size_t size()</code></span>
: return the number of prices in the data structure : return the number of prices in the data structure
</li> </li>
<li> <li>
<span class="inline-code"><code>double get()</code></span> <span><code>double get()</code></span>
: return the extrema (min or max) : return the extrema (min or max)
</li> </li>
</ul> </ul>
@ -104,9 +100,7 @@
<a <a
target="blank" target="blank"
href="https://en.cppreference.com/w/cpp/container/deque" href="https://en.cppreference.com/w/cpp/container/deque"
><span class="inline-code" ><span><code>std::deque&lt;double&gt;</code></span></a
><code>std::deque&lt;double&gt;</code></span
></a
>. >.
</p> </p>
<p> <p>
@ -115,13 +109,13 @@
operations. The minimum/maximum element must be found via a linear operations. The minimum/maximum element must be found via a linear
scan in \(O(n)\) time, certainly far from optimal. scan in \(O(n)\) time, certainly far from optimal.
</p> </p>
<div class="code" data-file="naive.cpp"</div> <div class="code" data-file="naive.cpp"></div>
</div> </div>
<h3>optimizing the approach</h3> <h3>optimizing the approach</h3>
<div class="problem-content"> <div class="problem-content">
<p> <p>
Rather than bear the brunt of the work finding extrema in calls to Rather than bear the brunt of the work finding extrema in calls to
<span class="inline-code"><code>get()</code></span <span><code>get()</code></span
>, we can distribute it across the data structure as it is built. >, we can distribute it across the data structure as it is built.
</p> </p>
<p> <p>
@ -214,13 +208,9 @@
</li> </li>
<li> <li>
The class could leverage templates to take in a comparator The class could leverage templates to take in a comparator
<span class="inline-code" <span><code>std::less&lt;double&gt;</code></span>
><code>std::less&lt;double&gt;</code></span
>
) to easily specify a minimum/maximum ) to easily specify a minimum/maximum
<span class="inline-code" <span><code>ExtremaCircularBuffer</code></span>
><code>ExtremaCircularBuffer</code></span
>
as well as a value type to support all operations. as well as a value type to support all operations.
</li> </li>
<li> <li>

View file

@ -53,16 +53,21 @@ li {
font-family: "Courier New", Courier, monospace; font-family: "Courier New", Courier, monospace;
padding: 2px 4px; padding: 2px 4px;
margin: 0 5px; margin: 0 5px;
border: 1px solid #e1e1e1;
border-radius: 4px;
font-size: 0.95em; font-size: 0.95em;
white-space: nowrap; white-space: nowrap;
border: 1px solid #e1e1e1;
} }
code { code,
pre {
border-radius: 4px;
background: #f4f4f4 !important; background: #f4f4f4 !important;
} }
pre {
border: 1px solid #e1e1e1;
}
.post-title::before { .post-title::before {
content: ""; content: "";
position: absolute; position: absolute;