<?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 Elissa Matsushita on Medium]]></title>
        <description><![CDATA[Stories by Elissa Matsushita on Medium]]></description>
        <link>https://medium.com/@elissa.matsushita?source=rss-149e0be707e7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*cxMpuW0l6fWct0TK</url>
            <title>Stories by Elissa Matsushita on Medium</title>
            <link>https://medium.com/@elissa.matsushita?source=rss-149e0be707e7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 23:49:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@elissa.matsushita/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[Linked Lists — a dynamic data structure.]]></title>
            <link>https://medium.com/@elissa.matsushita/linked-lists-a-dynamic-data-structure-56b6e23c9b42?source=rss-149e0be707e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/56b6e23c9b42</guid>
            <dc:creator><![CDATA[Elissa Matsushita]]></dc:creator>
            <pubDate>Sat, 07 Mar 2020 05:14:55 GMT</pubDate>
            <atom:updated>2020-03-08T18:57:43.502Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Linked Lists — a dynamic data structure.</strong></h3><p>When I first began learning how to code, much of my attention was focused on data and algorithms. As a new developer, it was important to build a strong problem solving foundation — a typical scenario looked like this: given a particular set of data, how can I implement an algorithm to transform this data and produce a particular output? But as I started to build my own programs, I started to realize the importance of how this data was organized. Data structures are the way in which we are able to store and retrieve data; the first data structures I was introduced to were simple arrays and objects. However, I soon learned there were many variations of these fundamental structures that allowed for optimizations such as decreased runtime or dynamic memory allocation. Today I’ll be talking about linked lists, which focus on the latter.</p><p>A linked list is a linear data structure that stores a variable number of values in sequential order. While they are similar to arrays, the primary benefit of a linked list is its ability to allocate memory dynamically on runtime (aka <strong>on demand</strong>). In other words, it acts like an array that can grow or shrink as needed in an efficient manner, and it does this by storing each list element in a self-contained node. Each node comprises of two compartments: its value and a reference to the next node, also known as a link. There are two nodes a linked list must keep track of: the head (first node) and tail (last node), as they differ slightly from the rest. The head is the entry point to the list, and a tail will have no following node.</p><p>A simple way to visualize a linked list is a train.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*vdI9yy9ZRVSVa4Fwek5vQg.png" /><figcaption>Image from ClipartLibrary</figcaption></figure><p>Each car can be compared to a node: each car is carrying its own cargo, and is linked to its previous and following cars, with the exception of the first and last car. Suppose you wanted to add a new car between the blue car and the green car. The structure of a linked list makes this process rather simple:</p><ul><li><strong>Step 1:</strong> Remove the existing link between the two cars</li><li><strong>Step 2: </strong>Add the new car</li><li><strong>Step 3: </strong>Create a link that stems from blue car to the new car</li><li><strong>Step 4:</strong> Create a link that stems from the new car to the green car</li></ul><p>A similar approach can be taken to remove an existing car. A linked list allows us to add or remove elements in any position with minimal side effects on other existing nodes.</p><p>Arrays, on the other hand, are an index-based data structure that is static in nature. Unlike linked lists, memory is assigned to arrays during compile time, meaning they are fixed in size.</p><p>A simple way to visualize this is a movie theatre.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*xLYa7wo8tQ4DYb5JVuG78g.png" /><figcaption>Image from Shutterstock</figcaption></figure><p>Imagine you and your friends are sitting in a movie theatre, waiting on one last friend to join. When he arrives, he decides he wants to sit between you and the person sitting on your left. In order to accommodate his request, you, along with everyone sitting to the right of you will have to stand up and shift one seat over. At best, this process is inconvenient and time-consuming. At worst, there are no seats left in the row, and your entire group will have to relocate to a row with enough space.</p><p>While the above examples illustrate the benefits of dynamic memory allocation, there are, of course, pitfalls. Because each node must store a reference to its following node, a linked list will occupy more memory than an array storing the same data.</p><p>Furthermore, linked lists do not support direct access — as mentioned earlier, the head is the only entry point to a linked list, meaning in order to access the <strong><em>n</em></strong><em>th </em>node, you must traverse through each of its preceding nodes. On the other hand, because arrays are index-based, you are able to access any random element at a given index without passing through its previous elements.</p><p>To conclude, while the dynamic nature of linked lists definitely offers flexibility for fluctuating data sets, it may not be the best choice if your main concern is storage space. As a developer, it’s important to consider what you intend on doing with the data — choosing the right data structure will allow your algorithm to run as smoothly and efficiently as possible.</p><h3>References</h3><ul><li><a href="https://www.cs.cmu.edu/~adamchik/15-121/lectures/Linked%20Lists/linked%20lists.html"><strong>Linked Lists</strong></a></li><li><a href="https://techdifferences.com/difference-between-array-and-linked-list.html#:~:text=The%20major%20difference%20between%20Array,element%20associated%20with%20an%20index.&amp;text=While%20a%20linked%20list%20is,linked%20to%20its%20next%20element."><strong>Differences Between Array and Linked Lists</strong></a></li><li><a href="https://www.youtube.com/watch?v=ChWWEncl76Y"><strong>Linked Lists | Data Structures in JavaScript</strong></a></li><li><a href="https://www.studytonight.com/data-structures/introduction-to-linked-list"><strong>Introduction to Linked Lists</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56b6e23c9b42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Game Tree with Tic Tac Toe]]></title>
            <link>https://medium.com/@elissa.matsushita/understanding-the-game-tree-with-tic-tac-toe-de64fad94afd?source=rss-149e0be707e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/de64fad94afd</guid>
            <dc:creator><![CDATA[Elissa Matsushita]]></dc:creator>
            <pubDate>Sun, 01 Mar 2020 19:48:41 GMT</pubDate>
            <atom:updated>2020-03-01T19:48:41.555Z</atom:updated>
            <content:encoded><![CDATA[<p>When I started my coding journey, it didn’t take long for me to realize that data is at the centre of everything. Much of what I was doing while learning the fundamentals involved accessing and manipulating data — and the way in which this data was stored greatly influenced these processes. As a beginner, the first data structures we were introduced to were linear, meaning each element is stored in sequential order, with no particular relationship between one another. Non-linear data structures, on the other hand, organize data hierarchically, meaning that each element is logically related to one another.</p><p>A tree is a popular data structure in computer science that many of those without programming backgrounds are also familiar with. Take the below family tree, for example: if you are at the root (the bottom) of this tree, you can map out your ancestors, starting with your parents, and then their parents and so on. Each node (relative) has a unique relationship to you, which can be traced by following the edges (connecting lines).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jowFsXyg_ZXZb_SCHd08Vw.png" /><figcaption>Image from <a href="https://creately.com/blog/examples/family-tree-templates-creately/">Creately.com</a></figcaption></figure><p>But how are trees used in programming, and what are the advantages of using them? While searching for examples of tree data structure applications, one in particular stood out to me: game theory (or the Game Tree). Playing games against artificial intelligence is nothing new, however, the process that occurs behind the scenes for your computer to make its decisions may surprise you.</p><p>Computers use an algorithm called the Minimax algorithm, which, given a specific state of a game, will simulate each possible next move, and for each of those moves will simulate their opponents next possible moves, and so on until each path reaches an end. For the sake of simplicity, I will use a game of Tic Tac Toe as an example to illustrate this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*OYJRPUtaHsr4WdTft1RYSg.png" /><figcaption>Image from <a href="https://github.com/LewisMatos/MiniMaxTicTacToe">Lewis Matos</a></figcaption></figure><p>Tic Tac Toe is a great entry point to understand the Game Tree for many reasons: it’s a two-player game with a relatively small range of outcomes, and it will always result in a win, loss or draw. The above image illustrates a snapshot of a game between PlayerX and PlayerY at the root, and all of the possible moves and outcomes computed using the Minimax algorithm below.</p><p>In this scenario, +1 represents a favourable outcome for PlayerX, 0 represents a draw, and -1 represents a favourable outcome for PlayerY. In other words, PlayerX is trying to <strong><em>maximize</em></strong> and PlayerY is trying to <strong><em>minimize</em></strong>. Take a look at the below pseudocode to see how the Minimax algorithm works:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*cpPXYKx9ExHwLSayFEC-aA.png" /></figure><p>The first block of code checks to see if the current state results in a win or loss — if this is true, the function will simply return the outcome.</p><p>Next, it will execute either the second or third block of code depending on whether it is maximizing or minimizing. Since our earlier example shows PlayerX’s turn, let’s walk through <em>maximizingPlayer</em> (second) block:</p><ul><li>The goal of this function is to return the move that holds the highest (maximum) value</li><li>In order to do this, we must evaluate all of the possible moves PlayerY can make for each of PlayerX’s possible moves, and so on until we reach a final outcome</li><li>The Minimax algorithm uses recursion to solve this: for each possible child node (move), it calls itself to evaluate each of its descendants</li><li>After it evaluates its descendants, it is able to determine <strong><em>maximum </em></strong>of its next possible moves (in this case, 0)</li></ul><p>In a game like Tic Tac Toe, the time it takes for a machine to execute this logic is minimal. But, for other games (take Chess, for example), the time it takes to calculate each possible outcome is much too long. Most games today will return an evaluation based on searching a just few moves ahead (rather than to the end of the game).</p><p>As a game becomes more complicated, it is not uncommon to optimize the above simple Minimax algorithm with extra functionality (such as <a href="https://www.cs.cmu.edu/~adamchik/15-121/lectures/Game%20Trees/Game%20Trees.html"><em>heuristic evaluation</em></a> and <a href="https://www.geeksforgeeks.org/minimax-algorithm-in-game-theory-set-4-alpha-beta-pruning/"><em>Alpha-Beta pruning</em></a>), however, the principle remains the same. The non-linear nature of the tree data structure is what allows the Minimax algorithm to logically evaluate the best possible move for a given player and board state.</p><h3><strong>Resources</strong></h3><ul><li><a href="https://www.yosenspace.com/posts/computer-science-game-trees.html"><em>Computer Science Game Trees</em></a></li><li><a href="https://www.youtube.com/watch?v=l-hh51ncgDI"><em>Algorithms Explained — Minimax and Alpha-Beta Pruning</em></a></li><li><a href="https://pediaa.com/what-is-the-difference-between-linear-and-non-linear-data-structures/#:~:text=The%20main%20difference%20between%20linear,of%20storing%20and%20managing%20data."><em>The Difference Between Linear and Non-Linear Data Structures</em></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de64fad94afd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>