<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Keep The Ball Rolling</title>
    <link>https://keep-rolling.writeas.com/</link>
    <description>Writting about things around</description>
    <pubDate>Fri, 21 Aug 2026 17:01:03 +0000</pubDate>
    <item>
      <title>4 of 100 days of code: Linked Lists</title>
      <link>https://keep-rolling.writeas.com/4-of-100-days-of-code-linked-lists?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[4 of 100 days of code: Linked Lists&#xA;&#xA;Starting on day 4th is not what I was expecting. Normally when you try to improve your discipline you want to start with day 1, but is better than nothing I guess. So, I am re-studying DSA and algorithms, and practicing some basic operations with linked lists.&#xA;&#xA;Here is the class which I will use for implement the operations:&#xA;&#xA;from typing import Optional, Any&#xA;&#xA;class Node:&#xA;    def init(self, val: Any, next: Optional[&#34;Node&#34;]=None):&#xA;        self.val = val&#xA;        self.next = next&#xA;&#xA;class SinglyLinkedList:&#xA;    def init(self):&#xA;        self.head: Optional[Node] = None&#xA;        self.size = 0&#xA;&#xA;So, the first one is the &#34;Insert at head&#34; or insert at start, or beginning. Using this class we have val, next, and size, well size for the linked list, it&#39;s obvious what that means.&#xA;&#xA;def insertathead(self, val: Any) -  None:&#xA;        node = Node(val, next=self.head)&#xA;        self.head = node&#xA;        self.size += 1&#xA;&#xA;We need to make the val is node, and object of the class, so we can have the val, and next attributes. And don&#39;t forget to increment the size.&#xA;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>4 of 100 days of code: Linked Lists</p>

<p>Starting on day 4th is not what I was expecting. Normally when you try to improve your discipline you want to start with day 1, but is better than nothing I guess. So, I am re-studying DSA and algorithms, and practicing some basic operations with linked lists.</p>

<p>Here is the class which I will use for implement the operations:</p>

<pre><code>from typing import Optional, Any

class Node:
    def __init__(self, val: Any, next: Optional[&#34;Node&#34;]=None):
        self.val = val
        self.next = next

class SinglyLinkedList:
    def __init__(self):
        self.head: Optional[Node] = None
        self.size = 0
</code></pre>

<p>So, the first one is the “Insert at head” or insert at start, or beginning. Using this class we have val, next, and size, well size for the linked list, it&#39;s obvious what that means.</p>

<pre><code>def insert_at_head(self, val: Any) -&gt; None:
        node = Node(val, next=self.head)
        self.head = node
        self.size += 1
</code></pre>

<p>We need to make the val is node, and object of the class, so we can have the val, and next attributes. And don&#39;t forget to increment the size.</p>
]]></content:encoded>
      <guid>https://keep-rolling.writeas.com/4-of-100-days-of-code-linked-lists</guid>
      <pubDate>Wed, 24 Sep 2025 10:22:55 +0000</pubDate>
    </item>
  </channel>
</rss>