<?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 Aimal Amiri on Medium]]></title>
        <description><![CDATA[Stories by Aimal Amiri on Medium]]></description>
        <link>https://medium.com/@aimalamiri?source=rss-5e2c21b87b9d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ckDdsoxhVmOE-kUaTMiQyA.jpeg</url>
            <title>Stories by Aimal Amiri on Medium</title>
            <link>https://medium.com/@aimalamiri?source=rss-5e2c21b87b9d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 06:03:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aimalamiri/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]]></title>
            <link>https://medium.com/@aimalamiri/linked-lists-345ee0e2c7b2?source=rss-5e2c21b87b9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/345ee0e2c7b2</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[linked-lists]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Aimal Amiri]]></dc:creator>
            <pubDate>Fri, 28 Oct 2022 07:52:14 GMT</pubDate>
            <atom:updated>2022-10-28T07:52:28.985Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OCojjF8trgtFZQ6v" /><figcaption>Photo by <a href="https://unsplash.com/@mikezo?utm_source=medium&amp;utm_medium=referral">Mike Alonzo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you’re a person who’s always scared of learning data structures and have no idea where to start, don’t worry. I’m here to explain and to begin with linked lists. A linked list is a linear data structure that stores data in nodes. A node is a type of object that keeps the data and a reference to the next node.</p><h4>Node</h4><p>As I said, a linked list is made of nodes, so I’ll begin by explaining what a node is and how to create a node object in JavaScript. And, simply, that contains only two parts: data and a link to the next node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*zrJY78GOlC3wiuTC8bYfgQ.png" /></figure><p>We can create a node like this in JavaScript</p><pre>Class Node {</pre><pre>  constructor(data) {</pre><pre>    this.data = data;</pre><pre>    this.next = null;</pre><pre>  }</pre><pre>}</pre><h4>List</h4><p>Okay, it’s the most exciting part of this article because we’re going to create the most important object called a list. Yes, I did say object! because this is going to be a class as well. We’re going to list all of our node object instances inside the List object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kyi0hwY0QSkNQF5zvoTytQ.png" /></figure><p>So here is the Linked List class.</p><pre>class LinkedList {</pre><pre>  constructor() {</pre><pre>    this.length = 0;</pre><pre>    this.head = null;</pre><pre>    this.tail = null;</pre><pre>  }</pre><pre>}</pre><p>As you see, we have three main properties in our linked list; length, head, and tail. So let me briefly explain each of them.</p><ol><li>Length is about storing the number of total nodes</li><li>The head is pointing to the beginning of the list (the first node)</li><li>The tail is pointing to the end of the list (the last node)</li></ol><p>So now let’s add the push method, which will add a node to the end of the list and will increase the length by 1.</p><pre>push(data) {</pre><pre>  const node = new Node(data);</pre><pre>  if (this.length === 0) {</pre><pre>    this.head = node;</pre><pre>    this.tail = node;</pre><pre>  } else {</pre><pre>    this.tail.next = node;</pre><pre>    this.tail = node;</pre><pre>  }</pre><pre>  this.length++;</pre><pre>}</pre><p>First of all, we create a node instance for our data. And we check if the list is empty to update both the head and tail, but if the list is not empty, we only update the next property of the tail node and assign the node to the tail because the tail must always keep the reference to the last node.</p><p>Now let’s get all of the nodes as an array to see how we can loop into our linked list.</p><pre>getAll() {</pre><pre>  let current = this.head;</pre><pre>  let result = [];</pre><pre>  while (current) {</pre><pre>    result.push(current.data);</pre><pre>    current = current.next;</pre><pre>  }</pre><pre>  return result;</pre><pre>}</pre><p>Here we begin from the head node and iterate until the last node, and we collect its data in the list array to return it at the end.</p><p>Here is the entire code.</p><pre>class Node {</pre><pre>  constructor(data) {</pre><pre>    this.data = data;</pre><pre>    this.next = null;</pre><pre>  }</pre><pre>}</pre><pre>class LinkedList {</pre><pre>  constructor() {</pre><pre>    this.length = 0;</pre><pre>    this.head = null;</pre><pre>    this.tail = null;</pre><pre>  }<br></pre><pre>  push(data) {</pre><pre>    const node = new Node(data);</pre><pre>    if (this.length === 0) {</pre><pre>      this.head = node;</pre><pre>      this.tail = node;</pre><pre>    } else {</pre><pre>      this.tail.next = node;</pre><pre>      this.tail = node;</pre><pre>    }</pre><pre>    this.length++;</pre><pre>  }</pre><pre>  getAll() {</pre><pre>    let current = this.head;</pre><pre>    let list = [];</pre><pre>    while (current) {</pre><pre>      list.push(current.data);</pre><pre>      current = current.next;</pre><pre>    }</pre><pre>    return list;</pre><pre>  }</pre><pre>}</pre><p>In the end, let’s check the time complexity of the Singly LinkedList.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*eiGkrUaH3VbMm7QHBxtR_Q.jpeg" /></figure><h4>Conclusion</h4><p>So, as you can see, it’s efficient to use the linked list if we mostly need to add data to our linked list, which makes it very popular. But it’s not a good idea to use a linked list when we need to read by index a lot, in that time Array is the best option.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=345ee0e2c7b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why is freelancing not good as a first programming job?]]></title>
            <link>https://medium.com/@aimalamiri/why-is-freelancing-not-good-as-a-first-programming-job-582b13b4b723?source=rss-5e2c21b87b9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/582b13b4b723</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[newprogrammer]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[freelancers]]></category>
            <dc:creator><![CDATA[Aimal Amiri]]></dc:creator>
            <pubDate>Sat, 11 Jun 2022 08:22:30 GMT</pubDate>
            <atom:updated>2022-06-11T08:22:30.424Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sQYv1Giy-G8Xrbh5" /><figcaption>Photo by <a href="https://unsplash.com/@perloov?utm_source=medium&amp;utm_medium=referral">Per Lööv</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>At first, I felt so fortunate not to have a boss, and since I have the complete freedom to work the way I want and I’m not accountable to anyone except my customers, I felt I could learn better because I’m not closed in the circle of rules. Yes, I was a freelance web developer at the beginning of my software development journey, and now I wish I knew to not do this at that time so that I could learn and grow better.</p><p>As I said, I wish I knew this because freelancing was extremely bad for my growth. Now imagine when you have a strict deadline for your project and you’re faced with a problem in coding, but you have no one to help you. How difficult is that? It’s leading to the imposter syndrome, and it’ll destroy your motivation. During that time, you can’t focus on the software quality; you just need to meet the deadline, so the worst happens after a bad scenario. You produce bad software. You want to satisfy your customers, but you fail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PX4C-yUhdmITCWEI" /><figcaption>Photo by <a href="https://unsplash.com/@e_sykes?utm_source=medium&amp;utm_medium=referral">Ethan Sykes</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>And this was pretty bad for my learning because I had no one to be accountable for, and I was not caring about the best practices and some other important stuff, which can be learned only in a full-time job, where a boss will tell you about the bad and good approaches. And you can learn a lot from an experienced person. You can learn a lot by knowing your weak points.</p><p>But there are some positive outcomes as well. For example, I learned some good skills too, like better communication with my customers, working under pressure, and problem-solving. which I will use all the time, and I can improve myself based on these powerful skills.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RxM6lUJEvnJ5ITeY" /><figcaption>Photo by <a href="https://unsplash.com/@freegraphictoday?utm_source=medium&amp;utm_medium=referral">AbsolutVision</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the end, I would say this was not a good experience. I spent a lot of energy fighting with imposter syndrome. I used a lot of time and had a small amount of growth. I used my time somewhat in a bad way. I could grow better, but anyway, this can be at least a good lesson for me and for the new developers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=582b13b4b723" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>