<?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 Mike Frazier on Medium]]></title>
        <description><![CDATA[Stories by Mike Frazier on Medium]]></description>
        <link>https://medium.com/@mike.fraz?source=rss-39c436c2394------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Xj5mumvU6foZA20Qi1Tdtw.jpeg</url>
            <title>Stories by Mike Frazier on Medium</title>
            <link>https://medium.com/@mike.fraz?source=rss-39c436c2394------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 02:47:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mike.fraz/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[Singly Linked Lists]]></title>
            <link>https://medium.com/@mike.fraz/singly-linked-lists-f525e78fdf95?source=rss-39c436c2394------2</link>
            <guid isPermaLink="false">https://medium.com/p/f525e78fdf95</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[Mike Frazier]]></dc:creator>
            <pubDate>Mon, 27 Jun 2016 01:31:20 GMT</pubDate>
            <atom:updated>2016-06-27T01:31:20.900Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Originally posted Feb. 9, 2016.</em></p><p>A singly linked list is a type of list data structure. Each node has a value key and a next key. The value key holds information about the node, a number, string, etc. The next key holds a reference to the next node in the list. When a node is first created, it is given a value for its key (value : ‘A’) and its next key is null. The next key remains null until a new node is created and the previous node stores a reference to the new node. In a singly linked list, the nodes store no reference to the previous node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/0*bmWRi67awIDeNcm5.png" /></figure><p>There are two other important properties when constructing a linked list. There are pointers to first node and the last node called the head and tail, respectively. Upon the creation of the first node in the list, the head points to that node. Consequently, because the first node is also the last node, the tail points there as well. When a new node is created, thetail points to the new end of the list. It should be noted that the head and tail only save references to the first and last nodes.</p><p>When searching a singly-linked list, the first node to be searched is the one referenced by the head object. This guarantees a search always begins at the first node and goes to the last (or until a data match is found).</p><p>It is easy to add nodes to the end of the linked list. The node is created; the current end of the list stores a reference to the new node at its next key; the tail is shifted to point to the last node. Adding a node to the start of a linked list involves a similar process. Although, this time the new node stores a reference to the current first node at its next key and the headis shifted to point to the new first node. The removal of the first node is same process as above but without creating a new node. The head is shifted to point to the second node. Although, once the head is shifted, there is no way to maintain access to the value of the former first node. A reference to it may be made to be used later when its data is required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/0*5U31FvxF5-jibFzM.png" /></figure><p>To remove a node in the middle of the list is a more complex operation. In the diagram below, the node with a value of D is going to be removed. That node cannot be simply deleted because then the previous node, C, would point to nothing, breaking the list. In order for the list to remain intact, C must point to the node following the D, the node with a value of E. Because D stores no reference to C, the operations must be done in the context of node C. Its next key of C must point to node E, and node E is stored as a reference on the next key of D. Therefore, the next key of C points to the reference stored at the next key of the node following it. Once that connection is made, node D is now circumvented and no longer a part of the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/0*ikQz2fboVln55BJb.png" /></figure><p>Following this procedure effectively removes node D but its value can no longer be accessed or returned. In order to maintain access, a reference to node D must be made and held in memory until the value is needed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f525e78fdf95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integer Increments and Decrements]]></title>
            <link>https://medium.com/@mike.fraz/integer-increments-and-decrements-f7178de73def?source=rss-39c436c2394------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7178de73def</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mike Frazier]]></dc:creator>
            <pubDate>Sun, 31 Jan 2016 20:01:58 GMT</pubDate>
            <atom:updated>2016-01-31T20:01:58.710Z</atom:updated>
            <content:encoded><![CDATA[<p>In Javascript, often times a variable assigned a number needs to be incremented or decremented to keep track of a counter or to iterate through an array. There are several ways that a variable can be changed by a value. With such options it can be difficult to know when each option should be used.</p><pre>// Method 1<br>var i = 1;<br>i = i + 1<br>console.log(i); // &gt;&gt; 2</pre><p>After Method 1 resolves, it is not surprising to find that `i` is equal to 2. A console log of `i` proves that. This is an intuitive method to increase the value of `i` by a some number. The method reads like a math equation and clearly demonstrates the intent of the expression.</p><pre>// Method 2<br>var j = 1;<br>j += 1;<br>console.log(j); // &gt;&gt; 2</pre><p>Method 2 is also fairly intuitive. This is a shorthand version of Method 1 and accomplish the same increment. Additionally, the ‘-’, ‘*’, and ‘/’ operators can also be used in the same way as the ‘+’ operator.</p><pre>//Method 3<br>var k = 1;<br>k++;<br>console.log(k); // &gt;&gt; 1</pre><p>This is unexpected. Why does `k` resolve to 1 after being acted upon by the `++` operation? The reason that `k` resolves to 1 after the `++` is because the current state of `k` is held onto before it is incremented. The current state of `k` is returned and then `k` is set to its new value. This causes `k` to only resolve to its incremented value after its current state has been used.</p><pre>//Method 3<br>var k = 1;<br>k++;<br>console.log(k); // &gt;&gt; 1<br>console.log(k); // &gt;&gt; 2</pre><p>Method 3 shows up often in for-loops iterating over arrays.</p><pre>for( var k = 0; k &lt; myArray.length; k++) {<br>  console.log(myArray[k]); <br>}</pre><p>When the conditions of the for-loop are set on the first iteration, `k` will remain equal to 0 until the code block is finished. When the conditions of the for-loop are set for the second iteration, the new value of `k` is used and is equal to 1.</p><pre>// Method 4<br>var m = 1;<br>++m;<br>console.log(m); // &gt;&gt; 2</pre><p>Method 4 looks strikingly similar to Method 3. Both use the `++` operator , but have them positioned on opposite sides of the variable. In Method 4, `m` is incremented first, and then its state is returned. This causes `m` to immediately resolve to its incremented value. Additionally, Methods 3 and 4 can be used with the ` — ` operator, following the same pattern as above.</p><p>Each method has its place in JavaScript. As a developer, you must choose the method that makes the most sense to you and to anyone, including yourself, that may look at your code down the line.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7178de73def" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>