<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>C&#43;&#43; on John Jr</title>
    <link>https://johnjr.dev/tags/c&#43;&#43;/</link>
    <description>Recent content in C&#43;&#43; on John Jr</description>
    <generator>Hugo</generator>
    <language>en</language>
    <managingEditor>blog@johnjr.dev (John Jr)</managingEditor>
    <webMaster>blog@johnjr.dev (John Jr)</webMaster>
    <lastBuildDate>Thu, 11 Dec 2025 13:11:25 -0500</lastBuildDate>
    <atom:link href="https://johnjr.dev/tags/c++/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Binary Search</title>
      <link>https://johnjr.dev/posts/binary-search/</link>
      <pubDate>Thu, 11 Dec 2025 13:11:25 -0500</pubDate><author>blog@johnjr.dev (John Jr)</author>
      <guid>https://johnjr.dev/posts/binary-search/</guid>
      <description>&lt;p&gt;One of the most fundamental algorithms that appears in interviews at big tech companies is &lt;a href=&#34;https://en.wikipedia.org/wiki/Binary_search&#34;&gt;Binary Search&lt;/a&gt;. Of course, nobody will ask you to implement binary search directly. However, as &lt;a href=&#34;https://en.wikipedia.org/wiki/Jon_Bentley_(computer_scientist)&#34;&gt;Jon Bentley&lt;/a&gt; cited in his famous book &lt;a href=&#34;https://www.amazon.com/Programming-Pearls-2nd-Jon-Bentley/dp/0201657880&#34;&gt;Programming Pearls&lt;/a&gt;, only a small percentage of people he asked—10% to be precise—were able to code this algorithm without any errors.&lt;/p&gt;&#xA;&lt;p&gt;Here, I will show you a correct implementation of binary search, its variants that appear in interviews, and &lt;a href=&#34;https://leetcode.com/&#34;&gt;LeetCode&lt;/a&gt; problems that you can solve using these techniques.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Builder Design Pattern and Cyclomatic Complexity Reduction</title>
      <link>https://johnjr.dev/posts/builder-design-pattern-and-cyclomatic-complexity-reduction/</link>
      <pubDate>Mon, 10 Nov 2025 10:00:00 -0500</pubDate><author>blog@johnjr.dev (John Jr)</author>
      <guid>https://johnjr.dev/posts/builder-design-pattern-and-cyclomatic-complexity-reduction/</guid>
      <description>&lt;p&gt;In this post, I will explain in detail how I used the &lt;a href=&#34;https://en.wikipedia.org/wiki/Builder_pattern&#34;&gt;builder design pattern&lt;/a&gt; together with the &lt;a href=&#34;https://en.wikipedia.org/wiki/Bit_field&#34;&gt;bit mask field&lt;/a&gt; technique to reduce complexity. As a result, I decreased the &lt;a href=&#34;https://en.wikipedia.org/wiki/Cyclomatic_complexity&#34;&gt;cyclomatic complexity&lt;/a&gt; from 24 to 0 and reduced development time from hours to minutes.&lt;/p&gt;&#xA;&lt;p&gt;The rest of this post is organized as follows sections:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#the-problem&#34;&gt;&lt;strong&gt;The problem&lt;/strong&gt;&lt;/a&gt; explains the problem I was solving.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#creating-the-bit-mask-field&#34;&gt;&lt;strong&gt;Creating the bit mask field&lt;/strong&gt;&lt;/a&gt; presents a solution to the problem.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#cyclomatic-complexity&#34;&gt;&lt;strong&gt;Cyclomatic Complexity&lt;/strong&gt;&lt;/a&gt; discusses cyclomatic complexity and calculates this metric for the solution presented in the section above.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#builder-design-pattern&#34;&gt;&lt;strong&gt;Builder design pattern&lt;/strong&gt;&lt;/a&gt; explains the builder design pattern and describes the refactoring process that removed complexity.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#conclusion&#34;&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/a&gt; summarizes this post.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#references&#34;&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/a&gt; provides references related to the topics discussed here.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;All the examples shown here are in C++.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
