diff --git a/posts/algorithms/extrema-circular-buffer.html b/posts/algorithms/extrema-circular-buffer.html index 58ebb74..1250223 100644 --- a/posts/algorithms/extrema-circular-buffer.html +++ b/posts/algorithms/extrema-circular-buffer.html @@ -51,23 +51,19 @@

Design a data structure supporting the following operations:

@@ -104,9 +100,7 @@ std::deque<double>std::deque<double>.

@@ -115,13 +109,13 @@ operations. The minimum/maximum element must be found via a linear scan in \(O(n)\) time, certainly far from optimal.

-
+

optimizing the approach

Rather than bear the brunt of the work finding extrema in calls to - get()get(), we can distribute it across the data structure as it is built.

@@ -214,13 +208,9 @@

  • The class could leverage templates to take in a comparator - std::less<double> + std::less<double> ) to easily specify a minimum/maximum - ExtremaCircularBuffer + ExtremaCircularBuffer as well as a value type to support all operations.
  • diff --git a/styles/post.css b/styles/post.css index 643efa2..9e16eba 100644 --- a/styles/post.css +++ b/styles/post.css @@ -53,16 +53,21 @@ li { font-family: "Courier New", Courier, monospace; padding: 2px 4px; margin: 0 5px; - border: 1px solid #e1e1e1; - border-radius: 4px; font-size: 0.95em; white-space: nowrap; + border: 1px solid #e1e1e1; } -code { +code, +pre { + border-radius: 4px; background: #f4f4f4 !important; } +pre { + border: 1px solid #e1e1e1; +} + .post-title::before { content: ""; position: absolute;