<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alexander Baumgarten on Medium]]></title>
        <description><![CDATA[Stories by Alexander Baumgarten on Medium]]></description>
        <link>https://medium.com/@SecurityByDesign?source=rss-8c427fafd59------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NGN6Uk75YGGQF2CFspmnbw.jpeg</url>
            <title>Stories by Alexander Baumgarten on Medium</title>
            <link>https://medium.com/@SecurityByDesign?source=rss-8c427fafd59------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 19 May 2026 06:55:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@SecurityByDesign/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Using Depth First Search to Determine if a Graph Contains a Cycle]]></title>
            <link>https://medium.com/@SecurityByDesign/using-depth-first-search-to-determine-if-a-graph-contains-a-cycle-4f8c6bbe8495?source=rss-8c427fafd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f8c6bbe8495</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[depth-first-search]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Alexander Baumgarten]]></dc:creator>
            <pubDate>Wed, 20 Apr 2022 17:43:00 GMT</pubDate>
            <atom:updated>2022-04-20T17:43:00.866Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Problem</h3><p>Given an undirected graph G, made up of a set of node V, and a set of edges E, we would like to determine if G contains a cycle in time relatives to the number of nodes.</p><h3>Understanding depth first search</h3><p>First to understand our solution we must understand depth first search (DFS).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*yQRB7BdhRGFzk9Piu6NDdg.jpeg" /></figure><p>DFS is a greedy algorithm which recursively traverses a tree left-to-right, exploring each deepest path. The algorithm runs first on a given root node, in this case [1]. We then check if the node v is our target node. If not, we recursively call DFS on each child node of v. If we have explored every node in the graph and haven’t found our target, the target does not exist in the graph G.</p><h3>Applying DFS to Finding Graph Cycles</h3><p>One given property of undirected graphs is that they have a cycle <strong>if and only if </strong>depth first search visits an already visited edge (aka a back edge). We can utilize this property, making a slight modification to DFS, to detect any cycles.</p><p>In our defined version of DFS we simply ignore already visited nodes. Instead, we’re going to intialize all nodes to the color white before we run the algorithm, and change the node color to black once it has been visited. This algorithm returns “cycle exists” if at any moment we find a node that is colored black already on what should be a new exploration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f8c6bbe8495" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding LinkedLists in Java]]></title>
            <link>https://medium.com/@SecurityByDesign/understanding-linkedlists-in-java-effa46b0e36?source=rss-8c427fafd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/effa46b0e36</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Alexander Baumgarten]]></dc:creator>
            <pubDate>Thu, 25 Nov 2021 00:07:44 GMT</pubDate>
            <atom:updated>2021-11-25T00:07:44.714Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/950/0*Sw4Jg3Qd3Xyfl2p8" /></figure><p>Linked Lists are an implementation of the AbstractList class in which we have an linear ordering of objects where each node has 32 components: the object, and a pointer to the next object in the list. The Linked List Object itself generally references a “head” node, or the first node in the linked list.</p><h3>Use Cases</h3><p>Linked Lists are extremely useful for constant time addition and deletion of elements. To add an element, all we have to do is change the pointer of the last object in the List to the new object. We can also treat the list as a first in — first out data structure, aka a “queue”.</p><p>Linked Lists may not be as useful when we need to grab a specific element of the index, as we don’t know where it is located at. When we want to grab a specific index, we have to iterate through the array up to that index which is a O(n) time operation compared to the constant time getIndex operation of a normal array.</p><p>LinkedLists can either be singular or doubly linked. A single linked list is one where each object only points to the next one in the List, not allowing us the ability to iterate backwards. Doubly linked lists have pointers to the previous and next node, allowing us to move freely in either direction till we hit the head or the tail.</p><h3>Class Methods</h3><p>The class holds various methods for both construction and utilizing the data structure</p><ul><li>add(E e) — adds an element e to the end of the List</li><li>clear() — removes all elements</li><li>contains(Object o) — returns true if the list contains o</li><li>get(int index) — gets the object at the index</li><li>indexOf(Object o) — returns index of object</li><li>peek() — Returns the object at the end of the list</li><li>pop() — removes the object at the end</li><li>remove(Object O) — removes specified object</li></ul><h3>Resource(s)</h3><p><a href="https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html">LinkedList (Java Platform SE 7 ) (oracle.com)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=effa46b0e36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Long Call Options]]></title>
            <link>https://medium.com/@SecurityByDesign/understanding-long-call-options-6346400efe93?source=rss-8c427fafd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/6346400efe93</guid>
            <category><![CDATA[options]]></category>
            <category><![CDATA[money]]></category>
            <category><![CDATA[investing]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[stocks]]></category>
            <dc:creator><![CDATA[Alexander Baumgarten]]></dc:creator>
            <pubDate>Sun, 21 Nov 2021 19:40:47 GMT</pubDate>
            <atom:updated>2021-11-21T19:40:47.777Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*41XFuuP-d_6w17H6" /><figcaption>Profit Loss diagram of a long call option</figcaption></figure><p>Long call options, or more simply “calls” are a defined risk derivative strategy used on a number of various equities.</p><p>Options are known for their hedging capabilities, i.e. their ability to guard against the risk of another play, much like insurace. While options are great for hedging, we can also utilize them as a leveraged gamble, either long or short, against a given stock.</p><h3>What is an option?</h3><p>In simple terms, a stock option is a contract that <em>gives us the right, but not the obligation</em>, to buy or sell shares of a certain equity at a certain price before a certain date. With long calls, these contracts give us the right to purchase a stock at a certain price before expiration. This means that if we purchase a long call with a strike price of $30 for a premium p1, and the stock increases in values to $50 per share, we are still able to purchase the stock at a price of $30 to whoever sold us the contract.</p><p>Since long call options are “defined risk” we can only lose the premium we paid for the contract, and theoretically have unlimited upside. While this may sound great, it gives no guarantee that the contract will be profitable before it expires.</p><h3>Premium</h3><p>Premium is what the seller of the contracts receives for their risk, much like insurance contracts. The total premium collected for a contract is determined by taking the premium * 100, as options contracts are written in bundles of 100 stock units.</p><p>Collecting premium for owning stock shares (aka selling covered calls) can be a valuable method of profiting during generally sideways markets, as we expect the long calls to expire worthless a majority of the time.</p><h3>Profits</h3><p>Profits for a long call are determined by the strike price and the premium the contract was purchased for. We can determine the profit for an “in the money” stock option by taking the current stock price minus the strike price of the option and minus any premium paid for the contract.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6346400efe93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding HTTP Strict Transport Security (HSTS)]]></title>
            <link>https://medium.com/@SecurityByDesign/understanding-http-strict-transport-security-hsts-cb910078d4be?source=rss-8c427fafd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb910078d4be</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[web-traffic]]></category>
            <category><![CDATA[https]]></category>
            <dc:creator><![CDATA[Alexander Baumgarten]]></dc:creator>
            <pubDate>Sun, 21 Nov 2021 16:02:41 GMT</pubDate>
            <atom:updated>2021-11-21T16:02:41.830Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/344/0*fiPVn64nLgkZUm-8" /><figcaption>An image showing the https protocol inside a web browser</figcaption></figure><p>HTTP strict transport security (commonly written as HSTS) is a browser response header allowing a website to specify that it should only be used through the hyper text transport secure protocol (HTTPS).</p><p>This security functionality ideally prevents visitors from accidentally requested the non secure version of the website, and being subjected to stolen information, or a man-in-the-middle attack. This is especially important when using an unsecured wifi-access point (AP), as we may not have verification that the AP is who they say they are.</p><h3>The Request</h3><p>When we first reach out to a website we don’t have stored in a cache, the browser returns the header <em>Strict-Transport-Security. </em>Your browser then records this information, and knows to access the site over HTTPS for any further requests while the header is still active.</p><pre>Strict-Transport-Security: max-age=300000000;</pre><p>Usually these headers have some time to expiration, and upon such we simply approach the website as we would have the first time around, upon which we receive a new header.</p><p>If we try to connect to an example website over HTTP now, the website will terminate our connection. This also may occur if the website no longer has a valid or signed SSL certificate.</p><h3><strong>Reference(s)</strong></h3><p><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security">Strict-Transport-Security — HTTP | MDN (mozilla.org)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb910078d4be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding HashMaps in Java]]></title>
            <link>https://medium.com/@SecurityByDesign/understanding-hashmaps-in-java-5bc613e94c06?source=rss-8c427fafd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bc613e94c06</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Alexander Baumgarten]]></dc:creator>
            <pubDate>Sat, 20 Nov 2021 19:51:14 GMT</pubDate>
            <atom:updated>2021-11-20T19:51:14.640Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*5SHcqUDP6QkI-19w.png" /></figure><p><a href="https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html">HashMaps</a> in Java 8 are an implementation of the AbstractMap class, allowing us to store a key value pair inside a non-ordered structure.</p><p>Each element in the structure consists of a Key, Value pair in which every key in the data structure is unique. We can use different types such as Integers, Strings, or Chars as a key value, but we must be able to tell them apart. For our Value, we can store any primitive or object, even a null object!</p><h3>Usage</h3><p>We define a HashMap in java with the definition</p><blockquote>HashMap&lt;KEY,VALUE&gt; map=<strong>new</strong> HashMap&lt;KEY,VALUE&gt;();</blockquote><p>This allows us to utilize any defined HashMap function such as put(), getKey(), and many more for that specific obect.</p><p>We unfortunately cannot use duplicate keys in Java HashMaps, and anytime we add a key that already exists, it will overwrite the current value stored in the map.</p><h3>Runtime</h3><p>A Java HashMap allows for constant time (O(1)) operations for the two basic operations, get() and put(). This however falls under the assumption that the hash function for the data type occurs in constant time as well. You can read more about hashing <a href="https://en.wikipedia.org/wiki/Hash_function#:~:text=%20A%20hash%20function%20may%20be%20considered%20to,to%20the%20size%20of%20the%20table%20More%20">here</a>.</p><p>Once we hash the key value, we take the hashValue modulus the # of buckets in the array, to find which bucket we place our object in. Each bucket consists of essentialy a LinkedList which we place our object for storage.</p><p>To retrieve an object by key, we simply hash the key value and check that “bucket” for any object containing the key. So if a single bucket contains every item in the hashmap, we aren’t actually gaining any efficiency, as every element is just stored in a single LinkedList.</p><p><strong>Reference(s)</strong></p><p><a href="https://www.javatpoint.com/java-hashmap">HashMap in Java — javatpoint</a></p><p><a href="https://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html">HashMap (Java Platform SE 7 ) (oracle.com)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bc613e94c06" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>