<?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 Uday Vikram Singh on Medium]]></title>
        <description><![CDATA[Stories by Uday Vikram Singh on Medium]]></description>
        <link>https://medium.com/@uvs2111?source=rss-f47b0865ae15------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6Qz1eZFU8HfFEnRPpcWukA.jpeg</url>
            <title>Stories by Uday Vikram Singh on Medium</title>
            <link>https://medium.com/@uvs2111?source=rss-f47b0865ae15------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:02:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@uvs2111/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 List : Explained Node by Node]]></title>
            <link>https://medium.com/@uvs2111/linked-list-explained-node-by-node-29121d59fccf?source=rss-f47b0865ae15------2</link>
            <guid isPermaLink="false">https://medium.com/p/29121d59fccf</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[linked-lists]]></category>
            <category><![CDATA[java-dsa]]></category>
            <dc:creator><![CDATA[Uday Vikram Singh]]></dc:creator>
            <pubDate>Sun, 24 Aug 2025 14:41:29 GMT</pubDate>
            <atom:updated>2025-08-24T14:41:29.401Z</atom:updated>
            <content:encoded><![CDATA[<h3>Linked List : Explained Node by Node</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iED-qy4DQXz2J9DwtVl0XQ.jpeg" /><figcaption>Linked List</figcaption></figure><h4>Arrays vs. Linked Lists: An Analogy</h4><blockquote>Have you ever wondered why <em>linked lists</em> were introduced when we already had <em>arrays</em> to store elements sequentially?</blockquote><blockquote>Imagine you want to store 5 elements: 1, 2, 3, 4, 5. With an <strong>array</strong>, they sit in a continuous block of memory — like 5 train coaches lined up on a single platform.</blockquote><blockquote>But memory doesn’t always come in one stretch. Sometimes, free spaces are scattered across different addresses: add1, add5, add9, add14, add55. Should we waste those scattered slots? Of course not. Memory is valuable, and this is where the <strong>linked list</strong> shines.</blockquote><blockquote>In a linked list, each node has:<br>The actual data.<br>A pointer/reference to the next node.</blockquote><blockquote>So our example becomes:<br> node1 [1, add5] → node2 [2, add9] → node3 [3, add14] → node4 [4, add55] → node5 [5, NULL]</blockquote><blockquote>This way, the linked list chains scattered memory blocks into one logical sequence, overcoming the biggest limitation of arrays: the need for contiguous memory.</blockquote><h4>Introduction</h4><p>A <strong>Linked List</strong> is a linear data structure made up of <strong>nodes</strong>, where each node stores two things:</p><ol><li>The data value.</li><li>A pointer (or reference) to the next node in the sequence.</li></ol><p>Unlike <strong>arrays</strong>, linked list nodes are not stored in contiguous memory. Instead, they are scattered across memory and connected using pointers, forming a chain-like structure.</p><p>One of the biggest strengths of linked lists is their <strong>dynamic nature</strong>. Memory can be allocated or freed at runtime as nodes are inserted or deleted, making them more flexible and memory-efficient than arrays.</p><p>Linked lists also serve as the foundation for other data structures such as <strong>stacks, queues, graphs, and hash maps</strong>.</p><h4>Representation of Linked List</h4><p>A <strong>Linked List</strong> is made up of nodes, where each node contains two parts:</p><ol><li>The <strong>data</strong>.</li><li>A reference (or pointer) to the <strong>next node</strong>.</li></ol><p>If a node does not have a next element, its pointer is set to <strong>NULL (or None in Python)</strong>, marking the end of the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*Psy1l1nEyK1kZPV1hZXNWA.png" /><figcaption>Linked List</figcaption></figure><h4>Generic Node class for Linked List</h4><pre>public class Node&lt;T&gt; {<br>    T data;       <br>    Node&lt;T&gt; next; <br><br>    public Node(T data) {<br>        this.data = data;<br>        this.next = null; <br>    }<br>}</pre><h4>Integer Type Node class for Linked List</h4><pre>public class Node {<br>    int data;<br>    Node next;<br><br>    public Node(int data) {<br>        this.data = data;<br>        this.next = null;<br>    }<br>}</pre><h4>Types of Linked List</h4><ol><li>Singly Linked List</li><li>Circular Singly Linked List</li><li>Doubly Linked List</li><li>Circular Doubly Linked List</li></ol><h4>Singly Linked List</h4><p>A Singly Linked List is the simplest form of a linked list where <strong>each node stores two parts</strong>: the data and a pointer to the next node in sequence.<br> Traversal is only possible in one direction — from the <strong>head node</strong> to the <strong>last node</strong>, which points to null.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*TNH5PTLfHgNcnGcQh-VUWg.png" /><figcaption>Singly Linked List</figcaption></figure><pre>// Node structure for Singly Linked List<br>class SNode {<br>    int data;<br>    SNode next;<br><br>    SNode(int d) { <br>        data = d; <br>        next = null; <br>    }<br>}<br><br>// Singly Linked List Implementation<br>class SinglyLinkedList {<br>    SNode head;<br><br>    // Insert at end - Time Complexity: O(n)<br>    void insertAtEnd(int data) {<br>        SNode newNode = new SNode(data);<br>        if (head == null) {<br>            head = newNode;<br>            return;<br>        }<br>        SNode curr = head;<br>        while (curr.next != null) curr = curr.next;<br>        curr.next = newNode;<br>    }<br><br>    // Delete a node by key - Time Complexity: O(n)<br>    void delete(int key) {<br>        SNode curr = head, prev = null;<br><br>        // Case 1: Key found at head<br>        if (curr != null &amp;&amp; curr.data == key) {<br>            head = curr.next; // Remove head<br>            return;<br>        }<br><br>        // Case 2: Traverse to find key<br>        while (curr != null &amp;&amp; curr.data != key) {<br>            prev = curr;<br>            curr = curr.next;<br>        }<br><br>        // Case 3: Key not found<br>        if (curr == null) return;<br><br>        // Case 4: Unlink the node<br>        prev.next = curr.next;<br>    }<br><br>    // Search a node - Time Complexity: O(n)<br>    boolean search(int key) {<br>        SNode curr = head;<br>        while (curr != null) {<br>            if (curr.data == key) return true;<br>            curr = curr.next;<br>        }<br>        return false;<br>    }<br><br>    // Display the linked list - Time Complexity: O(n)<br>    void display() {<br>        SNode curr = head;<br>        while (curr != null) {<br>            System.out.print(curr.data + &quot; -&gt; &quot;);<br>            curr = curr.next;<br>        }<br>        System.out.println(&quot;null&quot;);<br>    }<br>}<br><br>// Test the implementation<br>class TestSLL {<br>    public static void main(String[] args) {<br>        SinglyLinkedList ll = new SinglyLinkedList();<br><br>        // Manual creation of 3 nodes<br>        ll.head = new SNode(10);<br>        SNode second = new SNode(20);<br>        SNode third = new SNode(30);<br>        ll.head.next = second;<br>        second.next = third;<br><br>        // Display initial list<br>        ll.display(); // 10 -&gt; 20 -&gt; 30 -&gt; null<br><br>        // Insert at end<br>        ll.insertAtEnd(40);<br>        ll.display(); // 10 -&gt; 20 -&gt; 30 -&gt; 40 -&gt; null<br><br>        // Delete a node<br>        ll.delete(20);<br>        ll.display(); // 10 -&gt; 30 -&gt; 40 -&gt; null<br><br>        // Search nodes<br>        System.out.println(&quot;Search 30: &quot; + ll.search(30)); // true<br>        System.out.println(&quot;Search 99: &quot; + ll.search(99)); // false<br>    }<br>}</pre><h4>Example :</h4><p>1. Music playlist with only “next” button<br>2. Contact list traversal in phones.</p><h4>Circular Singly Linked List</h4><p>A Circular Singly Linked List is a variation of the singly linked list where the <strong>last node’s next pointer links back to the first node</strong>, forming a loop.<br> This structure enables <strong>continuous traversal</strong> since the list has no null end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*k3VTF9jKzLQ3YoGwvhziiw.png" /><figcaption>Circular Single Linked List</figcaption></figure><pre>// Node structure for Circular Singly Linked List<br>class CSNode {<br>    int data;<br>    CSNode next;<br><br>    CSNode(int d) { <br>        data = d; <br>        next = null; <br>    }<br>}<br><br>// Circular Singly Linked List Implementation<br>class CircularSinglyLinkedList {<br>    CSNode head;<br><br>    // Insert at end - Time Complexity: O(n)<br>    void insertAtEnd(int data) {<br>        CSNode newNode = new CSNode(data);<br>        if (head == null) {<br>            head = newNode;<br>            head.next = head; // Point back to itself<br>            return;<br>        }<br>        CSNode curr = head;<br>        while (curr.next != head) curr = curr.next;<br>        curr.next = newNode;<br>        newNode.next = head; // Maintain circular structure<br>    }<br><br>    // Delete a node by key - Time Complexity: O(n)<br>    void delete(int key) {<br>        if (head == null) return;<br>        CSNode curr = head, prev = null;<br><br>        // Case 1: Key is at head<br>        if (head.data == key) {<br>            // Only one node<br>            if (head.next == head) {<br>                head = null;<br>                return;<br>            }<br>            // More than one node<br>            CSNode tail = head;<br>            while (tail.next != head) tail = tail.next; // Find last node<br>            head = head.next;<br>            tail.next = head;<br>            return;<br>        }<br><br>        // Case 2: Key not at head → search through list<br>        do {<br>            prev = curr;<br>            curr = curr.next;<br>            if (curr.data == key) {<br>                prev.next = curr.next;<br>                return;<br>            }<br>        } while (curr != head);<br>    }<br><br>    // Search for a node - Time Complexity: O(n)<br>    boolean search(int key) {<br>        if (head == null) return false;<br>        CSNode curr = head;<br>        do {<br>            if (curr.data == key) return true;<br>            curr = curr.next;<br>        } while (curr != head);<br>        return false;<br>    }<br><br>    // Display the circular list - Time Complexity: O(n)<br>    void display() {<br>        if (head == null) {<br>            System.out.println(&quot;List empty&quot;);<br>            return;<br>        }<br>        CSNode curr = head;<br>        do {<br>            System.out.print(curr.data + &quot; -&gt; &quot;);<br>            curr = curr.next;<br>        } while (curr != head);<br>        System.out.println(&quot;(head)&quot;);<br>    }<br>}<br><br>// Test the implementation<br>class TestCSLL {<br>    public static void main(String[] args) {<br>        CircularSinglyLinkedList csll = new CircularSinglyLinkedList();<br><br>        // Manual creation of 3 nodes<br>        csll.head = new CSNode(10);<br>        CSNode second = new CSNode(20);<br>        CSNode third = new CSNode(30);<br>        csll.head.next = second;<br>        second.next = third;<br>        third.next = csll.head; // Close the circle<br><br>        // Display initial list<br>        csll.display(); // 10 -&gt; 20 -&gt; 30 -&gt; (head)<br><br>        // Insert at end<br>        csll.insertAtEnd(40);<br>        csll.display(); // 10 -&gt; 20 -&gt; 30 -&gt; 40 -&gt; (head)<br><br>        // Delete a node<br>        csll.delete(20);<br>        csll.display(); // 10 -&gt; 30 -&gt; 40 -&gt; (head)<br><br>        // Search nodes<br>        System.out.println(&quot;Search 30: &quot; + csll.search(30)); // true<br>        System.out.println(&quot;Search 99: &quot; + csll.search(99)); // false<br>    }<br>}</pre><h4>Example :</h4><p>1. Browser back/forward navigation<br>2. Photo viewer with next/previous buttons.</p><h4>Doubly Linked List</h4><p>A Doubly Linked List is a two-way linked list where each node contains <strong>three parts</strong>: the data, a pointer to the next node, and a pointer to the previous node.<br> This bidirectional linking allows traversal in both <strong>forward and backward</strong> directions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*mSUJWUL9wa0AEzx2ukqZ7A.png" /><figcaption>Doubly Linked List</figcaption></figure><pre>// Node structure for Doubly Linked List<br>class DNode {<br>    int data;<br>    DNode next, prev;<br><br>    DNode(int d) { <br>        data = d; <br>        next = prev = null; <br>    }<br>}<br><br>// Doubly Linked List Implementation<br>class DoublyLinkedList {<br>    DNode head;<br><br>    // Insert at end - Time Complexity: O(n)<br>    void insertAtEnd(int data) {<br>        DNode newNode = new DNode(data);<br>        if (head == null) {<br>            head = newNode;<br>            return;<br>        }<br>        DNode curr = head;<br>        while (curr.next != null) curr = curr.next;<br>        curr.next = newNode;<br>        newNode.prev = curr;<br>    }<br><br>    // Delete a node by key - Time Complexity: O(n)<br>    void delete(int key) {<br>        DNode curr = head;<br>        while (curr != null) {<br>            if (curr.data == key) {<br>                // Case 1: Node is not head<br>                if (curr.prev != null) curr.prev.next = curr.next;<br>                else head = curr.next; // Move head if first node deleted<br>                // Case 2: Node is not tail<br>                if (curr.next != null) curr.next.prev = curr.prev;<br>                return;<br>            }<br>            curr = curr.next;<br>        }<br>    }<br><br>    // Search for a node - Time Complexity: O(n)<br>    boolean search(int key) {<br>        DNode curr = head;<br>        while (curr != null) {<br>            if (curr.data == key) return true;<br>            curr = curr.next;<br>        }<br>        return false;<br>    }<br><br>    // Display forward - Time Complexity: O(n)<br>    void displayForward() {<br>        DNode curr = head;<br>        while (curr != null) {<br>            System.out.print(curr.data + &quot; &lt;-&gt; &quot;);<br>            curr = curr.next;<br>        }<br>        System.out.println(&quot;null&quot;);<br>    }<br><br>    // Display backward - Time Complexity: O(n)<br>    void displayBackward() {<br>        if (head == null) {<br>            System.out.println(&quot;List empty&quot;);<br>            return;<br>        }<br>        // Move to last node<br>        DNode curr = head;<br>        while (curr.next != null) curr = curr.next;<br>        // Traverse backward<br>        while (curr != null) {<br>            System.out.print(curr.data + &quot; &lt;-&gt; &quot;);<br>            curr = curr.prev;<br>        }<br>        System.out.println(&quot;null&quot;);<br>    }<br>}<br><br>// Test the implementation<br>class TestDLL {<br>    public static void main(String[] args) {<br>        DoublyLinkedList dll = new DoublyLinkedList();<br><br>        // Manual creation of 3 nodes<br>        dll.head = new DNode(10);<br>        DNode second = new DNode(20);<br>        DNode third = new DNode(30);<br>        dll.head.next = second;<br>        second.prev = dll.head;<br>        second.next = third;<br>        third.prev = second;<br><br>        // Display forward<br>        dll.displayForward(); // 10 &lt;-&gt; 20 &lt;-&gt; 30 &lt;-&gt; null<br><br>        // Insert at end<br>        dll.insertAtEnd(40);<br>        dll.displayForward(); // 10 &lt;-&gt; 20 &lt;-&gt; 30 &lt;-&gt; 40 &lt;-&gt; null<br><br>        // Delete a node<br>        dll.delete(20);<br>        dll.displayForward(); // 10 &lt;-&gt; 30 &lt;-&gt; 40 &lt;-&gt; null<br><br>        // Display backward<br>        dll.displayBackward(); // 40 &lt;-&gt; 30 &lt;-&gt; 10 &lt;-&gt; null<br><br>        // Search nodes<br>        System.out.println(&quot;Search 30: &quot; + dll.search(30)); // true<br>        System.out.println(&quot;Search 99: &quot; + dll.search(99)); // false<br>    }<br>}</pre><h4>Example :</h4><p>1. CPU task scheduling (round-robin)<br>2. Multiplayer game turn rotation.</p><h4>Circular Doubly Linked List</h4><p>A Circular Doubly Linked List is a type of doubly linked list where the <strong>last node’s next pointer connects back to the first node</strong>, and the <strong>first node’s previous pointer links to the last node</strong>.<br> This setup enables <strong>continuous traversal</strong> in both forward and backward directions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*DdSEZ2zumIOMGy9nQtv0zg.png" /><figcaption>Circular Linked List</figcaption></figure><pre>// Node structure for Circular Doubly Linked List<br>class CDNode {<br>    int data;<br>    CDNode next, prev;<br><br>    CDNode(int d) {<br>        data = d;<br>        next = prev = null;<br>    }<br>}<br><br>// Circular Doubly Linked List Implementation<br>class CircularDoublyLinkedList {<br>    CDNode head;<br><br>    // Insert at end - Time Complexity: O(1) since we use head.prev<br>    void insertAtEnd(int data) {<br>        CDNode newNode = new CDNode(data);<br>        if (head == null) {<br>            head = newNode;<br>            head.next = head.prev = head;<br>            return;<br>        }<br>        CDNode tail = head.prev;<br>        tail.next = newNode;<br>        newNode.prev = tail;<br>        newNode.next = head;<br>        head.prev = newNode;<br>    }<br><br>    // Delete node by key - Time Complexity: O(n)<br>    void delete(int key) {<br>        if (head == null) return;<br><br>        CDNode curr = head;<br>        do {<br>            if (curr.data == key) {<br>                // Case 1: only one node<br>                if (curr.next == curr) {<br>                    head = null;<br>                    return;<br>                }<br>                // Adjust pointers<br>                curr.prev.next = curr.next;<br>                curr.next.prev = curr.prev;<br>                // If deleting head, move head<br>                if (curr == head) head = curr.next;<br>                return;<br>            }<br>            curr = curr.next;<br>        } while (curr != head);<br>    }<br><br>    // Search node by key - Time Complexity: O(n)<br>    boolean search(int key) {<br>        if (head == null) return false;<br>        CDNode curr = head;<br>        do {<br>            if (curr.data == key) return true;<br>            curr = curr.next;<br>        } while (curr != head);<br>        return false;<br>    }<br><br>    // Display forward - Time Complexity: O(n)<br>    void displayForward() {<br>        if (head == null) {<br>            System.out.println(&quot;List empty&quot;);<br>            return;<br>        }<br>        CDNode curr = head;<br>        do {<br>            System.out.print(curr.data + &quot; &lt;-&gt; &quot;);<br>            curr = curr.next;<br>        } while (curr != head);<br>        System.out.println(&quot;(head)&quot;);<br>    }<br><br>    // Display backward - Time Complexity: O(n)<br>    void displayBackward() {<br>        if (head == null) {<br>            System.out.println(&quot;List empty&quot;);<br>            return;<br>        }<br>        CDNode tail = head.prev;<br>        CDNode curr = tail;<br>        do {<br>            System.out.print(curr.data + &quot; &lt;-&gt; &quot;);<br>            curr = curr.prev;<br>        } while (curr != tail);<br>        System.out.println(&quot;(head)&quot;);<br>    }<br>}<br><br>// Test class<br>class TestCDLL {<br>    public static void main(String[] args) {<br>        CircularDoublyLinkedList cdll = new CircularDoublyLinkedList();<br><br>        // manual creation of 3 nodes<br>        cdll.head = new CDNode(10);<br>        CDNode second = new CDNode(20);<br>        CDNode third = new CDNode(30);<br><br>        cdll.head.next = second;<br>        second.prev = cdll.head;<br>        second.next = third;<br>        third.prev = second;<br>        third.next = cdll.head;<br>        cdll.head.prev = third;<br><br>        // Display forward<br>        cdll.displayForward(); // 10 &lt;-&gt; 20 &lt;-&gt; 30 &lt;-&gt; (head)<br><br>        // Insert at end<br>        cdll.insertAtEnd(40);<br>        cdll.displayForward(); // 10 &lt;-&gt; 20 &lt;-&gt; 30 &lt;-&gt; 40 &lt;-&gt; (head)<br><br>        // Delete a node<br>        cdll.delete(20);<br>        cdll.displayForward(); // 10 &lt;-&gt; 30 &lt;-&gt; 40 &lt;-&gt; (head)<br><br>        // Display backward<br>        cdll.displayBackward(); // 40 &lt;-&gt; 30 &lt;-&gt; 10 &lt;-&gt; (head)<br><br>        // Search<br>        System.out.println(&quot;Search 30: &quot; + cdll.search(30)); // true<br>        System.out.println(&quot;Search 99: &quot; + cdll.search(99)); // false<br>    }<br>}</pre><h4>Example :</h4><p>1. Image carousel looping<br>2. Media player playlist with repeat-all</p><h4>Frequently Asked Linked List Interview questions</h4><p><a href="https://www.geeksforgeeks.org/dsa/top-50-linked-list-interview-question/">Top 50 Problems on Linked List Data Structure asked in SDE Interviews - GeeksforGeeks</a></p><h4>Summary</h4><p>Unlike arrays that need continuous memory, <strong>Linked Lists</strong> use pointers to connect scattered nodes dynamically. This makes them powerful for fast insertions, deletions, and flexible traversal. Variants like singly, doubly, and circular linked lists solve different real-world problems, making them a must-know concept for both <strong>data structures mastery and coding interviews</strong>.</p><p>If you found this article helpful, please consider <strong>liking, sharing</strong>, or <strong>leaving a comment</strong>.</p><p>Stay curious, and happy coding! 👨‍💻👩‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29121d59fccf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Arrays: A Foundational Data Structure Across Languages]]></title>
            <link>https://medium.com/@uvs2111/understanding-arrays-a-foundational-data-structure-across-languages-deb7ecf690c5?source=rss-f47b0865ae15------2</link>
            <guid isPermaLink="false">https://medium.com/p/deb7ecf690c5</guid>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[sad]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[lists]]></category>
            <dc:creator><![CDATA[Uday Vikram Singh]]></dc:creator>
            <pubDate>Tue, 08 Jul 2025 09:42:31 GMT</pubDate>
            <atom:updated>2025-07-08T09:42:31.075Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nT3YpQ6rP51EPUry-90IxA.jpeg" /><figcaption>Arrays</figcaption></figure><p>Arrays are among the most fundamental data structures in programming. Whether you’re writing code in Java, C++, Python, or JavaScript, arrays serve as the backbone of efficient data storage and access.</p><p>But what exactly are arrays, and why are they so essential?</p><h3>What Is an Array?</h3><p>An array is a collection of elements, all of the same type, stored in contiguous memory locations. Think of it like a row of mailboxes, each labeled with a number (index) and holding a single item.</p><p>This means you can:</p><ul><li><strong>Access elements in constant time</strong> using their index.</li><li><strong>Store multiple values under a single variable name.</strong></li><li><strong>Efficiently manipulate large datasets.</strong></li></ul><p>In array indexing start from 0 and goes till n-1 , where n is the size of array.</p><pre>int[] arr = {1,2,3};<br>// This is an array of size 3<br><br>// Index of first element <br>System.out.println(arr[0]);<br><br>// Index of second element <br>System.out.println(arr[1]);<br><br>// Index of third element <br>System.out.println(arr[2]);<br><br>// As you can see last element is accessed by idx=n-1 i.e idx=3-1=2</pre><h3>Why Use Arrays?</h3><p>Let’s say you want to store the marks of 5 students:</p><pre>int marks1 = 10;<br>int marks2 = 20;<br>...</pre><p>This quickly becomes messy. Instead:</p><pre>int[] marks = {90, 87, 93, 85, 88};</pre><p>Now you can loop through, update, and analyze all the values much more easily.</p><p>Arrays:<br>1. Reduce code redundancy<br>2. Make loops and logic easier to manage<br>3. Enable performance optimization in memory access</p><p>Now that we’ve covered what arrays are and why they’re useful, let’s dive into different types of arrays.</p><h3>Types of Arrays</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_2WL_d28nUZ4GX7wAUl9Vg.jpeg" /><figcaption>Types of Array</figcaption></figure><h4>1-D Arrays</h4><p>Consider 1-D array as row where elements are stored one after the other.</p><h4>2–D Arrays</h4><p>Consider 2-D arrays as table where each cell stores element</p><h4>3-D Arrays</h4><p>Consider 3-D arrays like a cuboid made up of smaller cuboids where each cuboid can contain an element.</p><p>Now that we’ve covered types of arrays, let’s dive into internal working and memory storage of arrays.</p><h3><strong>Behind the Scenes: How Arrays Store Data</strong></h3><p><strong>Memory Layout<br></strong>Arrays use <strong>contiguous memory blocks</strong>, meaning elements are placed next to each other.</p><p><strong>Fixed Size<br></strong>In low-level languages like C/C++, array sizes are <strong>fixed at compile time</strong>. In high-level languages like Python, lists (dynamic arrays) are more flexible.</p><p><strong>Type Consistency<br></strong>Java and C++ enforce <strong>type uniformity</strong> in arrays. Python lists allow mixed types but aren’t true arrays unless you use the array module or numpy.</p><p><strong>Insertion/Deletion<br></strong>Costly (O(n)) as elements may need to be shifted.</p><h3>Where Are Arrays Stored: Stack vs. Heap?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Hm-RT9bAc6CfTq2qoMLvg.jpeg" /><figcaption>Array stored in Stack/Heap</figcaption></figure><h3><strong>Array vs. ArrayList in Java — A quick comparison of performance, memory, and usability.</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQuFuKKOLx3L7l5dpImk_w.jpeg" /><figcaption>Java : Array v/s ArrayList</figcaption></figure><h3>Python: array.array vs list — Key differences in performance, type support, and flexibility.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-FMQgZF0m5ZRP-ka4zWPhw.jpeg" /><figcaption>Python: array.array v/s list</figcaption></figure><h3>Common Array Operations in Java, C++, and Python: A Side-by-Side Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6MXSefEG4r-4rcGc3XI_XA.jpeg" /><figcaption>Common Array Operations : Java, C++, Python</figcaption></figure><p>Note : <br>1. Java and C++ require <strong>different syntax for static vs. dynamic arrays</strong>.<br>2. Python’s <strong>list is dynamic by default</strong> and more flexible<br>3. array.array in Python behaves more like Java/C-style arrays but requires specifying a type-code and is more limited.</p><h3>Conclusion</h3><p>Arrays are the bedrock of data structures in most programming languages. They offer fast, predictable access time and efficient memory layout, making them perfect for situations where fixed-size, homogeneous data needs to be stored. However, as your applications grow more dynamic, you may need more flexible alternatives like ArrayLists in Java or lists in Python.</p><p>Understanding the strengths and limitations of arrays across languages like Java, C++, and Python helps you make informed design choices and write more efficient code. Mastering this foundational concept will give you the confidence to explore advanced data structures and algorithms</p><p>If you found this article helpful, please consider <strong>liking, sharing</strong>, or <strong>leaving a comment</strong>.</p><p>Stay curious, and happy coding! 👨‍💻👩‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deb7ecf690c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Time and Space Complexity: Does It Really Matter?]]></title>
            <link>https://medium.com/@uvs2111/time-and-space-complexity-does-it-really-matter-925b90340b04?source=rss-f47b0865ae15------2</link>
            <guid isPermaLink="false">https://medium.com/p/925b90340b04</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[asymptotic-notation]]></category>
            <category><![CDATA[space-complexity]]></category>
            <category><![CDATA[interview-preparation]]></category>
            <category><![CDATA[time-complexity]]></category>
            <dc:creator><![CDATA[Uday Vikram Singh]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 17:41:13 GMT</pubDate>
            <atom:updated>2025-06-27T17:56:51.659Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EaJKdEnirxxNp_lX6AqKXQ.jpeg" /><figcaption>Time and Space Complexity</figcaption></figure><h3>Introduction</h3><p>What exactly is <strong>Time and Space Complexity</strong>?<br>How does it improve our understanding of <strong>Data Structures and Algorithms (DSA)</strong>?<br> nd the most important question — <strong>is it relevant in DSA interviews</strong>?</p><p>A lot of questions, huh?<br>Let’s tackle them one by one and get a clear understanding of what complexity analysis is all about.</p><h3>What Is Time Complexity?</h3><p><strong>By Definition:</strong></p><blockquote><em>Time complexity describes how the </em><strong><em>execution time</em></strong><em> of an algorithm increases with respect to the </em><strong><em>input size (n).</em></strong></blockquote><blockquote><strong><em>Important:</em></strong><em><br> </em><em>Time Complexity ≠ Actual Time Taken<br> It’s not about how many seconds it takes, but </em><strong><em>how fast the algorithm grows</em></strong><em> as inputs get larger.</em></blockquote><h3>Why Not Just Measure Time Taken?</h3><p>Let’s consider a scenario:</p><p>You and your friend are asked to implement <strong>Merge Sort</strong> in an interview.</p><ul><li>You’re coding on an Intel Core i3 laptop.</li><li>Your friend has a MacBook Air with a faster processor.</li></ul><p>Even if you both write the exact same algorithm, your friend’s code might run faster due to hardware differences.<br> <strong>Would it be fair to judge you based on runtime alone?</strong> Absolutely not.</p><p>That’s where <strong>time complexity</strong> comes into play — it helps us evaluate algorithms <strong>independent of hardware or language</strong>.</p><p>Also, often there are multiple ways to solve the same problem. Time complexity lets us <strong>compare and choose the most efficient solution</strong>.</p><h3>Enter Asymptotic Notation</h3><p>Asymptotic notations are <strong>mathematical tools</strong> used to describe the <strong>efficiency of algorithms</strong> as input size increases.</p><h3>Types of Asymptotic Notations</h3><ol><li><strong>Big-O Notation</strong> <em>(O)</em> — Describes the <strong>worst-case</strong> scenario.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*1QrzL9zfVBbyb-JC_y0PwA.png" /><figcaption>Big-O Notation</figcaption></figure><p><strong>2. Omega Notation</strong> <em>(Ω)</em> — Describes the <strong>best-case</strong> scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*dmudkt_e68WQDU9skXsT-g.png" /><figcaption>Omega-Notation</figcaption></figure><p><strong>3. Theta Notation</strong> <em>(Θ)</em> — Describes the <strong>average-case</strong> or <strong>tight bound</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*aDESL7RvQHTsUWLPwtT15w.png" /><figcaption>Theta Notation</figcaption></figure><blockquote><em>📌 </em><strong><em>Pro Tip:</em></strong><em><br> We usually calculate </em><strong><em>Big-O</em></strong><em> in practice, because if an algorithm performs well in the worst-case, it’s likely to perform well overall.</em></blockquote><h3>Common Time Complexities (from Best to Worst)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*tpoO231giKMI6YQSkmD5kA.png" /><figcaption>Common Types of Algorithm Complexity</figcaption></figure><p>The chart below visualizes how these grow as input increases:</p><ul><li><strong>O(1)</strong> — Constant time<br> The algorithm takes the same time, regardless of input size.</li><li><strong>O(log n)</strong> — Logarithmic<br> Time grows slowly as input increases (e.g., binary search).</li><li><strong>O(n)</strong> — Linear<br> Time increases proportionally with input.</li><li><strong>O(n log n)</strong> — Linearithmic<br> Typical for efficient sorting algorithms like merge sort.</li><li><strong>O(n²)</strong> — Quadratic<br> Often found in nested loops (e.g., bubble sort).</li><li><strong>O(2ⁿ)</strong> — Exponential<br> Time doubles with each increase in input (e.g., recursive Fibonacci).</li><li><strong>O(n!)</strong> — Factorial<br> Extremely inefficient (e.g., solving the traveling salesman problem brute-force).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*VMtsZnZpgnBz183KosvL-g.png" /><figcaption>Increasing Complexity (Best to Worst)</figcaption></figure><h3>What Is Space Complexity?</h3><p><strong>By Definition:</strong></p><blockquote><em>Space complexity measures the </em><strong><em>amount of memory</em></strong><em> an algorithm uses relative to the input size.</em></blockquote><blockquote><strong><em>Important:</em></strong><em><br> </em><em>Space Complexity ≠ RAM Used by Your System<br> It refers to </em><strong><em>extra space</em></strong><em> your algorithm needs to run efficiently.</em></blockquote><p>A good algorithm aims to minimize space usage while maintaining performance.<br> Sometimes, <strong>time-space trade-offs</strong> are involved — using more space to save time or vice versa.</p><h3>How to Analyze Time and Space Complexity</h3><p>Let’s look at a few <strong>real examples</strong> using code.</p><p><strong>Time Complexity Solved Problems</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pyrBRdGRIz47601IdQxccQ.jpeg" /><figcaption>Problem 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5tpl4sDKTbY_iZ68Qg-IQ.jpeg" /><figcaption>Problem 2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9AMPlwNwsjFSqzYVK4prkw.jpeg" /><figcaption>Problem 3</figcaption></figure><p><strong>Space Complexity Solved Problems</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n7uoDDC_rVtAxwRb6-yqag.jpeg" /><figcaption>Problem 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7L5nJLj0UTK9XfzkbUOkWw.jpeg" /><figcaption>Problem 2</figcaption></figure><h3>Practice Problems &amp; Resources</h3><p>Want to get better at analyzing complexity? Practice is key.<br> Here’s a great resource to dive deeper:<br>🔗 <a href="https://launchschool.com/books/dsa/read/time_and_space_complexity_problems">Launch School — Time and Space Complexity Problems</a></p><h3>Conclusion</h3><ul><li>Time and space complexity are <strong>core tools</strong> in the DSA toolbox.</li><li>They help us write <strong>efficient, scalable</strong> algorithms.</li><li>Mastering complexity analysis will give you a huge edge in <strong>technical interviews</strong>.</li></ul><p>If you found this article helpful, please consider <strong>liking, sharing</strong>, or <strong>leaving a comment</strong>.</p><p>Stay curious, and happy coding! 👨‍💻👩‍💻</p><p>Like and follow for more articles like this one !!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=925b90340b04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Catching What Eyes Can’t See: Visual Regression Testing for Modern Web Apps]]></title>
            <link>https://medium.com/@uvs2111/catching-what-eyes-cant-see-visual-regression-testing-for-modern-web-apps-b1ffa5fb477c?source=rss-f47b0865ae15------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1ffa5fb477c</guid>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[visual-regression-testing]]></category>
            <category><![CDATA[regression-testing]]></category>
            <category><![CDATA[quality-matter]]></category>
            <dc:creator><![CDATA[Uday Vikram Singh]]></dc:creator>
            <pubDate>Mon, 12 May 2025 03:46:46 GMT</pubDate>
            <atom:updated>2025-05-19T18:31:34.043Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*t6z28bt9dO7un-lFdMCtKw.png" /><figcaption>Visual Regression Testing</figcaption></figure><p>Modern UIs evolve constantly, with frequent changes to colors, layouts, and fonts. While unit, functional, and end-to-end tests ensure application logic works, they often miss subtle <strong>visual bugs</strong> — like misaligned buttons or overlapping elements — that can break the user experience.</p><p><strong>Visual Regression Testing (VRT)</strong> addresses this gap by comparing UI snapshots over time to catch unintended visual changes. It ensures the interface looks and behaves as expected after every update, making it essential for maintaining a polished, consistent user experience.</p><p>In this guide, we’ll explore how VRT works and how to effectively integrate it into your testing workflow using tools like <strong>Percy</strong> and <strong>Cypress</strong>.</p><h3>What is Visual Regression Testing?</h3><p>VRT or Visual Regression Testing is a testing suite that is designed specifically to spot new bugs in an application’s graphical user interface. Its modern approach differs from the classic regression testing paradigm which deals primarily with the identification and localization of bugs pertaining to code functionality. Rather, VRT or visual regression testing deals primarily deals with issues concerning the users visual interaction with the software interface. This includes elements such as the arrangement of components on the screen, colors, fonts, logos, and aspects of responsiveness (how the application behaves and how components rearrange themselves on different screens).</p><ul><li>The tool takes <strong>screenshots</strong> of the application’s UI before and after changes.</li><li>It compares these images <strong>pixel by pixel</strong> (or using smarter visual diffs).</li><li>If any <strong>differences</strong> exceed a defined threshold, it flags the test as failed.</li></ul><p>This means even small, unexpected shifts — like a misaligned button or hidden text — can be detected <strong>automatically</strong>, without relying on manual visual review.</p><h3>🧠 Why VRT Matters</h3><p>Imagine a scenario:</p><ul><li>A developer makes a minor change to a CSS class.</li><li>The functionality remains intact — the button still works — but its position shifts slightly.</li><li>Functional tests pass. Manual QA might miss it.</li><li>But the visual experience is broken — and that’s what the end user sees.</li></ul><p>Visual Regression Testing helps bridge this critical gap by ensuring <strong>pixel-perfect UI consistency</strong> across updates.</p><h3>🖼️ Types of Visual Bugs it Catches</h3><ul><li>Misalignment of elements</li><li>Broken layout due to responsive design issues</li><li>Color or font changes</li><li>Overlapping or hidden UI elements</li><li>Z-index and stacking issues</li><li>Theme-related (dark/light mode) inconsistencies</li></ul><p>VRT is especially valuable in:</p><ul><li><strong>Design-heavy applications</strong></li><li><strong>Component-driven development (React, Angular, Vue)</strong></li><li><strong>Continuous Delivery (CD) pipelines</strong> where UI changes are frequent</li></ul><p>As software teams adopt faster release cycles, VRT acts as a visual safety net — guarding your brand’s visual identity while the code evolves.</p><h3>⚙️ How Does Visual Regression Testing Work?</h3><p>At its core, <strong>Visual Regression Testing</strong> follows a fairly simple workflow — but there’s more intelligence under the hood than it might appear. Let’s break it down into steps:</p><h4>🧭 Step-by-Step Workflow</h4><ol><li><strong>Baseline Image Capture</strong></li></ol><ul><li>The first time tests are run, the tool captures screenshots of your application’s UI in various states (e.g., home page, login modal, product list).</li><li>These images become your <strong>baseline</strong>, representing the expected appearance of the UI.</li></ul><p><strong>2. Application Changes</strong></p><ul><li>Developers commit new code (e.g., styling, layout, or component logic changes).</li><li>These changes may or may not affect the UI visually.</li></ul><p><strong>3. New Snapshot Generation</strong></p><ul><li>After the changes, the VRT tool re-runs the test suite and captures <strong>new screenshots</strong> of the same UI states.</li></ul><p><strong>4. Image Comparison (Diffing)</strong></p><ul><li>The new snapshots are compared to the baseline images using <strong>pixel-by-pixel comparison</strong> or <strong>visual AI</strong>.</li><li>The tool generates a <strong>“diff image”</strong> highlighting mismatches — usually in bright red or purple.</li></ul><p><strong>5. Threshold &amp; Tolerance Settings</strong></p><ul><li>Minor pixel-level differences (like anti-aliasing or font rendering) can trigger false positives.</li><li>Tools let you configure <strong>thresholds</strong>, ignore certain elements, or mask dynamic content.</li></ul><p><strong>6. Test Results</strong></p><ul><li>If the visual differences exceed the acceptable threshold, the test fails.</li><li>You can then review the diff, accept the new image as the updated baseline (if intentional), or fix the issue.</li></ul><h3>📸 Visual Regression Testing with Percy &amp; Cypress</h3><p>To demonstrate <strong>Visual Regression Testing</strong>, I integrated <strong>Percy</strong> with <strong>Cypress</strong>. Percy helps capture and compare UI screenshots over time, highlighting even the smallest unintended UI changes.</p><h4>✅ Step 1: Initial Setup &amp; Baseline Snapshot</h4><p>I created a basic Cypress test that visits <a href="https://example.com/">example.com</a> and takes a baseline snapshot using:</p><pre>describe(&#39;Percy Visual Test&#39;, () =&gt; {<br>  it(&#39;Visits a website and takes a snapshot&#39;, () =&gt; {<br>    cy.visit(&#39;https://example.com&#39;);<br>    cy.percySnapshot(&#39;Example Page&#39;); <br>  });<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AmoZ6ygvc3Nap1EOqsfX8A.png" /><figcaption>Baseline page</figcaption></figure><h4>🔄 Step 2: Introduce a Visual Change</h4><p>To simulate a UI change, I updated the test to change the background color:</p><pre>describe(&#39;Visual Regression Testing with Percy&#39;, () =&gt; {<br>  it(&#39;Visits the website and takes a snapshot with changes&#39;, () =&gt; {<br>    cy.visit(&#39;https://example.com&#39;);<br><br>    cy.get(&#39;body&#39;).invoke(&#39;css&#39;, &#39;background-color&#39;, &#39;lightblue&#39;);<br><br>    cy.percySnapshot(&#39;Example Page - Modified&#39;); <br>  });<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8fIJ38BJzTMLg2BfddgXCA.png" /><figcaption>Modifies page</figcaption></figure><h3>🧠 What Percy Did</h3><p>Percy automatically compared the new snapshot with the baseline and highlighted the change. This helps catch visual regressions early without manually checking the UI.</p><h3>Benefits of Visual Regression Testing</h3><ol><li><strong>Catches What Functional Tests Miss : </strong>Functional tests confirm behavior, but VRT ensures that <strong>“looking right”</strong> is part of the definition of done.</li></ol><p><strong>2. Improves Developer Confidence : </strong>Teams can refactor front-end code or. update dependencies without fear of silently breaking the UI.</p><p><strong>3. Saves Time in Manual UI Checks : </strong>Instead of manually reviewing dozens of pages, VRT highlights only the <strong>differences</strong>, making visual QA faster and smarter.</p><p><strong>4. Supports Agile &amp; Continuous Delivery : </strong>Frequent releases require fast, automated assurance. VRT acts as a visual safety net in CI/CD pipelines.</p><p><strong>5. Protects Brand Identity : </strong>Even tiny visual flaws can erode user trust. VRT ensures brand consistency across updates.</p><p><strong>6. Easy Collaboration on UI Feedback : </strong>With visual diffs, designers, testers, and developers can <strong>literally see</strong> what changed — no more vague bug reports.</p><h3>💬 Real-World Impact</h3><p>Companies like <strong>Spotify</strong>, <strong>Shopify</strong>, and <strong>Salesforce</strong> use VRT to validate everything from minor UI tweaks to major design overhauls — reducing the number of post-release visual bugs dramatically.</p><h3>⚠️ Challenges and Limitations of Visual Regression Testing</h3><p>While <strong>VRT</strong> is highly effective, it comes with some challenges:</p><p><strong>1. False Positives from Dynamic Content</strong></p><ul><li><strong>Issue</strong>: Dynamic elements like ads or live data can trigger false positives.</li><li><strong>Solution</strong>: Mask dynamic regions or exclude elements prone to change.</li></ul><p><strong>2. Rendering Differences Across Browsers</strong></p><ul><li><strong>Issue</strong>: Browsers may render images or fonts differently.</li><li><strong>Solution</strong>: Set tolerance thresholds or use AI-powered tools (e.g., Applitools).</li></ul><p><strong>3. Large Image Files in CI/CD</strong></p><ul><li><strong>Issue</strong>: High-resolution images can slow down CI/CD pipelines.</li><li><strong>Solution</strong>: Compress images or limit test scope.</li></ul><p><strong>4. Handling Animations &amp; Dynamic UI</strong></p><ul><li><strong>Issue</strong>: Animations or real-time data can cause variations.</li><li><strong>Solution</strong>: Pause animations or exclude dynamic content.</li></ul><h3>📌 Best Practices for Visual Regression Testing</h3><p>To get the most out of <strong>Visual Regression Testing</strong>, consider these best practices:</p><p><strong>1. Set Clear Thresholds : </strong>Configure <strong>tolerance levels</strong> to avoid false positives from minor rendering differences (e.g., font anti-aliasing).</p><p><strong>2. Mask Dynamic Content : </strong>Exclude regions with dynamic elements (ads, live data) to avoid unnecessary diffs.</p><p><strong>3. Test Across Viewports : </strong>Ensure <strong>responsive design</strong> by testing on multiple screen sizes and orientations.</p><p><strong>4. Integrate with CI/CD : </strong>Automate VRT as part of your <strong>CI/CD pipeline</strong> to catch UI bugs early in the development process.</p><p><strong>5. Review Diff Images Regularly : </strong>Regularly <strong>review and update baselines</strong> to ensure VRT captures only relevant visual changes.</p><p><strong>6. Use AI-Powered Tool : </strong>Leverage <strong>AI-based tools</strong> like Applitools for smarter, more accurate visual comparisons that mimic human judgment.</p><p><strong>7. Start Small, Scale Gradually : </strong>Begin with testing critical pages or components and expand coverage as your team becomes more comfortable with VRT.</p><h3>🔚 Conclusion</h3><p>In the domain of software applications, Visual Regression Testing (VRT) has become vital in helping maintain UI consistency as well as preventing visual breaks. It allows for seamless experience maintenance even when the code undergoes modified changes and the user interface is updated along with the design system.</p><p>Along with VRT assisting in capturing minute and more complex intricacies of UI design, and the smooth fitting into CI/CD pipelines, there tends to be challenges with VRT such as false positives and differences in rendering. Through the use of best practices with AI tools, those challenges can be alleviated. thus making it easier to confidently ship software with detailed visual polish.</p><p>As today’s development world advances, the interface part of the software is as important as the functioning part and because of that, VRT is critical to integrate during the early stages of software development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1ffa5fb477c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Code to Cloud: Building a Complete CI/CD Pipeline Using AWS Lambda, Serverless Framework &…]]></title>
            <link>https://medium.com/@uvs2111/from-code-to-cloud-building-a-complete-ci-cd-pipeline-using-aws-lambda-serverless-framework-4a29e7ef2221?source=rss-f47b0865ae15------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a29e7ef2221</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Uday Vikram Singh]]></dc:creator>
            <pubDate>Wed, 09 Apr 2025 09:11:30 GMT</pubDate>
            <atom:updated>2025-04-27T08:29:37.400Z</atom:updated>
            <content:encoded><![CDATA[<h3>From Code to Cloud: Building a Complete CI/CD Pipeline Using AWS Lambda, Serverless Framework &amp; GitHub Actions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EBXc9eJ1YRFLtkNI_djaAw.png" /><figcaption>DevOps Lifecycle: A Continuous Process of Development and Operations</figcaption></figure><p>So, if you’ve landed on this article, chances are you’ve at least <em>heard</em> the buzzword <strong>DevOps</strong> — even if you’re not fully sure what it means. Trust me, you’re not alone!</p><h3>But What Is DevOps, Really?</h3><p>According to <em>The DevOps Handbook</em> by Gene Kim:</p><blockquote><em>“DevOps is the combination of cultural philosophies, practices, and tools that increases an organization’s ability to deliver applications and services at high velocity.”</em></blockquote><p>In simpler terms: <strong>DevOps helps teams ship software faster, more reliably, and with automation at its core.</strong></p><h3>🚀 What Are We Building?</h3><p>We’ll be building a <strong>complete CI/CD pipeline</strong> using:</p><ul><li><strong>AWS Lambda</strong> (serverless function execution)</li><li><strong>Serverless Framework</strong> (to simplify deployment)</li><li><strong>GitHub Actions</strong> (for CI/CD automation)</li></ul><p>And don’t worry — we’ll take it step by step. First, let’s understand the key tools and concepts we’ll be using.</p><h3>🔑 Key Terms You Should Know</h3><ul><li><strong>CI/CD</strong>: Continuous Integration/Continuous Deployment</li><li><strong>Serverless</strong>: Running code without managing servers</li><li><strong>AWS Lambda</strong>: A function-as-a-service offering by AWS</li><li><strong>GitHub Actions</strong>: GitHub’s native CI/CD automation tool</li><li><strong>Jest</strong>: JavaScript testing framework</li><li><strong>ESLint / Prettier</strong>: Tools for code quality and formatting</li><li><strong>CloudWatch</strong>: AWS’s logging and monitoring service</li></ul><h3>🛠️ Prerequisites</h3><p>Make sure you have the following ready:</p><ul><li><strong>Node.js</strong>: Required for local development</li><li><strong>AWS Account</strong>: To deploy Lambda functions</li><li><strong>IAM User + Access Keys</strong>: For secure CLI-based deployment</li><li><strong>GitHub Account</strong>: To set up GitHub Actions</li><li><strong>JavaScript Basics</strong>: To follow and modify the function</li></ul><h3>Step 1: Set Up Your Serverless Project</h3><p>Use the following command to create a new Serverless Framework project:</p><pre>npx serverless create --template aws-nodejs --path my-simple-app</pre><p>This sets up the folder structure and boilerplate files (handler.js, serverless.yml).</p><p><strong>File: Serverless.yml</strong></p><pre>service: my-simple-app<br>provider:<br>  name: aws<br>  runtime: nodejs18.x<br>functions:<br>  hello:<br>    handler: handler.hello<br>    events:<br>      - http:<br>          path: hello<br>          method: get</pre><h3>Step 2: Write Your Lambda Function</h3><p>Let’s keep it simple for now — just a basic response:</p><p><strong>File: handler.js</strong></p><pre>module.exports.hello = async () =&gt; {<br>  return {<br>    statusCode: 200,<br>    body: JSON.stringify({ message: &quot;Hello, DevOps world!&quot; }),<br>  };<br>};</pre><h3><strong>Step3: Add Testing with Jest</strong></h3><p>Jest is a JavaScript testing framework used to write and run unit tests. It’s simple and works great with Node.js projects, including AWS Lambda functions.</p><p><strong>File: __tests__/handler.test.js</strong></p><pre>// __tests__/handler.test.js<br>const { hello } = require(&quot;../handler&quot;); // CommonJS require<br><br>describe(&quot;hello function&quot;, () =&gt; {<br>  it(&#39;should return a statusCode of 200 and &quot;Hello, DevOps world!&quot; message&#39;, async () =&gt; {<br>    const result = await hello();<br>    expect(result.statusCode).toBe(200);<br>    const body = JSON.parse(result.body);<br>    expect(body.message).toBe(&quot;Hello, DevOps world!&quot;);<br>  });<br>});</pre><p>To run the test locally</p><pre>npm test</pre><h3><strong>Step4: Configure GitHub Actions for CI/CD</strong></h3><p>Here’s a sample workflow to automate testing and deployment:</p><p><strong>File: .github/workflows/deploy.yml</strong></p><pre>name: Deploy Serverless App<br><br>on:<br>  push:<br>    branches:<br>      - main<br><br>jobs:<br>  deploy:<br>    runs-on: ubuntu-latest<br><br>    steps:<br>      - name: Checkout Code<br>        uses: actions/checkout@v3<br><br>      - name: Install Dependencies<br>        run: |<br>          npm install -g serverless@3<br>          npm install<br><br>      - name: Lint Code<br>        run: npm run lint<br><br>      - name: Check Formatting<br>        run: npm run format-check<br><br>      - name: Run Tests<br>        run: npm test<br><br>      - name: Upload Coverage<br>        if: always()<br>        uses: actions/upload-artifact@v4<br>        with:<br>          name: coverage-report<br>          path: coverage<br><br>      - name: Deploy to AWS<br>        if: success()<br>        env:<br>          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}<br>          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>        run: |<br>          serverless deploy</pre><h3><strong>Step5: Enable Monitoring and Logs</strong></h3><p>Your Lambda logs are automatically available in <strong>AWS CloudWatch</strong>.<br> To view them:</p><blockquote><em>AWS Console → CloudWatch → Log Groups → Your Lambda function</em></blockquote><h3><strong>Step 6: Add Linting and Prettier for Code Quality</strong></h3><p>This ensures:</p><ol><li>Preventing bad code from being deployed.</li><li>Maintaining consistency.</li></ol><p><strong>File: eslint.config.mjs</strong></p><pre>{<br>  &quot;name&quot;: &quot;serverless_app&quot;,<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;main&quot;: &quot;index.js&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;lint&quot;: &quot;eslint .&quot;,<br>    &quot;format-check&quot;: &quot;prettier --check .&quot;,<br>    &quot;format-fix&quot;: &quot;prettier --write .&quot;,<br>    &quot;test&quot;: &quot;jest --coverage&quot;<br>  },<br>  &quot;keywords&quot;: [],<br>  &quot;author&quot;: &quot;&quot;,<br>  &quot;license&quot;: &quot;ISC&quot;,<br>  &quot;description&quot;: &quot;&quot;,<br>  &quot;devDependencies&quot;: {<br>    &quot;@eslint/js&quot;: &quot;^9.20.0&quot;,<br>    &quot;eslint&quot;: &quot;^9.20.1&quot;,<br>    &quot;globals&quot;: &quot;^15.15.0&quot;,<br>    &quot;jest&quot;: &quot;^29.7.0&quot;,<br>    &quot;prettier&quot;: &quot;^3.5.1&quot;<br>  }<br>}</pre><h3><strong>Step7: Add Code Coverage Report</strong></h3><p>Code Coverage tells us how much of our code is tested by unit tests.</p><pre>npm test -- --coverage</pre><p>Your coverage report will be generated in the coverage/ folder and uploaded as a CI artifact in GitHub Actions.</p><h3>🔄 Summary of CI/CD Flow</h3><ul><li>Code is pushed to the GitHub repository (main branch).</li><li>Code is <strong>linted</strong> using ESLint.</li><li><strong>Prettier</strong> checks for formatting consistency.</li><li><strong>Unit tests</strong> run using Jest.</li><li><strong>Coverage report</strong> is uploaded.</li><li>If everything passes, <strong>Serverless Framework deploys</strong> the app to AWS Lambda.</li><li><strong>CloudWatch</strong> captures logs for monitoring.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XrSXf-Lhht0RnbDhg_bamw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5egQD4Dk3185yLGryKoQhQ.png" /><figcaption>GitHub Actions</figcaption></figure><h3>✅ Final Thoughts</h3><p>In this article, we successfully:</p><ul><li>Built a simple AWS Lambda function</li><li>Wrote unit tests with Jest</li><li>Ensured code quality with ESLint and Prettier</li><li>Automated the full CI/CD pipeline using GitHub Actions</li><li>Deployed to AWS using Serverless Framework</li><li>Enabled real-time logs and monitoring with CloudWatch</li></ul><h3>🔗 GitHub Repository</h3><p>Check out the full code here:</p><p><a href="https://github.com/udaysingh21/Serverless_App">https://github.com/udaysingh21/Serverless_App</a></p><p>Feel free to <strong>fork, clone, and create your own pipeline</strong>!</p><p><strong><em>Eat. Sleep. Deploy. Repeat.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a29e7ef2221" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Internship Interview Experience @ OpenPlay Technologies]]></title>
            <link>https://medium.com/@uvs2111/internship-interview-experience-at-openplay-technologies-80504d01489a?source=rss-f47b0865ae15------2</link>
            <guid isPermaLink="false">https://medium.com/p/80504d01489a</guid>
            <category><![CDATA[python-developer-intern]]></category>
            <category><![CDATA[data-structure-algorithm]]></category>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[openplay]]></category>
            <dc:creator><![CDATA[Uday Vikram Singh]]></dc:creator>
            <pubDate>Thu, 21 Mar 2024 16:03:12 GMT</pubDate>
            <atom:updated>2024-03-21T16:16:01.840Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*-EGGnvRZcHUopG16k8V-PQ.jpeg" /></figure><p>Hello Everyone,</p><p>Today I will share my Interview Experience at <strong>OpenPlay Technologies</strong> for the<strong> </strong>6 months<strong> Python Developer Intern position.</strong></p><p>First, let me brief you about the company, OpenPlay is a gaming company based in Hyderabad which is known for its Classic Rummy Game, and NAZARA recently acquired it in the Real Money Gaming Industry.</p><p>I applied for the internship through LinkedIn and got an interview call for the first Technical round on 15th February.</p><p>In the first round, they asked me 2–3 DSA questions which they asked me to do live by sharing the screen.</p><blockquote><a href="https://leetcode.com/problems/two-sum/description/"><strong>Two Sum</strong></a></blockquote><blockquote><a href="https://leetcode.com/problems/maximum-subarray/description/"><strong>Kadane’s Algorithm (Maximum sum subarray)</strong></a></blockquote><blockquote><strong>The third one was related to Graph.</strong></blockquote><p>The interviewer also asked about other algorithms&#39; time complexity and asked me to explain the <strong>difference between Quick Sort and Merge Sort.</strong></p><p>During the interview, I was questioned about <strong>APIs </strong>and <strong>Web Sockets</strong>. Additionally, I was tasked with writing <strong>SQL queries</strong> and explaining different types of joins</p><p>After 2 weeks, I got a call for the second Technical round. This round was around 1 hour.</p><p>The interview started with a general introduction. I was asked basic Python questions like the difference between list and tuples, pickling and unpickling, how the dictionary works internally, and other questions. <strong>I was also asked to implement merge sort where if the variable ascending is set to True then merge sort should return an ascending sorted array and if the ascending variable is set to False then merge sort should return the descending sorted array.</strong></p><pre>def mergesort(arr,l,r,ascending):<br>    if l&lt;r:<br>        m=(l+r)//2<br><br>        mergesort(arr,l,m,ascending)<br>        mergesort(arr,m+1,r,ascending)<br>        merging(arr,l,m,r,ascending)<br><br><br>def merging(arr,l,m,r,ascending):<br>    i=l<br>    j=m+1<br>    temp=[0]*(r-l+1)<br>    k=0<br><br>    if ascending:<br><br>        while i&lt;=m and j&lt;=r:<br>            if arr[i]&lt;=arr[j]:<br>                temp[k]=arr[i]<br>                k+=1<br>                i+=1<br>            else:<br>                temp[k]=arr[j]<br>                k+=1<br>                j+=1<br><br>        while i&lt;=m:<br>            temp[k]=arr[i]<br>            k+=1<br>            i+=1<br><br>        while j&lt;=r:<br>            temp[k]=arr[j]<br>            k+=1<br>            j+=1<br><br>    else:<br>        while i &lt;= m and j &lt;= r:<br>            if arr[i] &lt;= arr[j]:<br>                temp[k] = arr[j]<br>                k += 1<br>                j += 1<br>            else:<br>                temp[k] = arr[i]<br>                k += 1<br>                i += 1<br><br>        while i &lt;= m:<br>            temp[k] = arr[i]<br>            k += 1<br>            i += 1<br><br>        while j &lt;= r:<br>            temp[k] = arr[j]<br>            k += 1<br>            j += 1<br><br>    i=l<br>    for val in temp:<br>        arr[i]=val<br>        i+=1<br><br><br>if __name__==&quot;__main__&quot;:<br>    array=[8,2,-1,4,0,-3]<br>    ascending=False<br>    mergesort(array,0,len(array)-1,ascending)<br>    print(array)</pre><p>There were a few more questions regarding the company&#39;s values and mission.</p><p>After four days HR called me and informed me that I had successfully cleared the second round and was offered the Python Developer Intern position.</p><p>This interview taught me important things, like how to stay confident and handle situations where I didn’t know the answer. Overall, it was a good experience that made me feel more sure of myself.</p><p>Regrettably, I had to decline the internship offer due to unforeseen personal circumstances. However, I encourage anyone who receives such an opportunity to seize it eagerly!!</p><p>For more captivating interview experiences, make sure to hit the <strong>like</strong> and <strong>follow </strong>button.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80504d01489a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scholar @ SAP LABS Interview Experience]]></title>
            <link>https://medium.com/@uvs2111/scholar-sap-labs-interview-experience-184e10116382?source=rss-f47b0865ae15------2</link>
            <guid isPermaLink="false">https://medium.com/p/184e10116382</guid>
            <category><![CDATA[interview-tips]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[interview-experience]]></category>
            <category><![CDATA[scholar-program]]></category>
            <category><![CDATA[sap-labs]]></category>
            <dc:creator><![CDATA[Uday Vikram Singh]]></dc:creator>
            <pubDate>Tue, 23 Jan 2024 08:51:37 GMT</pubDate>
            <atom:updated>2024-01-26T14:22:29.073Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*ReAuZR5VyFVBl6kE7et9RQ.jpeg" /></figure><p>Hello Everyone,</p><p>This is my first article on Medium and today I will share my Interview Experience at <strong>SAP LABS, India</strong> for the <strong>SCHOLAR</strong> position.</p><p>SAP LABS visited my campus (SRMCEM, Lucknow) in July 2023.</p><p><strong>ELIGIBILITY CRITERIA:</strong></p><blockquote>BE/B. Tech 2024 batch</blockquote><blockquote>Specializations in CS/ISE/ECE/EE</blockquote><blockquote>Graduation score of 70% or above</blockquote><blockquote>10th &amp; 12th scores of 60% and above</blockquote><p>First, let me give you a brief idea about SAP’s SCHOLAR program.</p><p>Under this program you will work as a<strong> full-time employee from Monday to Friday and on Saturday you will have your MTECH (from BIT’S PILANI)</strong> classes on the office campus only, faculty from BITS will come and teach you.</p><p>On 17th July they had an interactive virtual connect session where they gave company information, what the company does, about its clients and growth cycle, etc.</p><p><strong>SAP LABS conducted four rounds:</strong></p><blockquote>Online Coding Test (HackerRank)<br>Technical Interview -1 <br>Technical Interview -2 <br>HR/Managerial Round</blockquote><p>On the 21st of July, we had our first round which was an <strong>Online Coding Test</strong> conducted on the HackerRank platform. The test consisted of 2 coding questions, both from the string. My <strong>first question</strong> was to Reverse the string and find the number of characters that didn’t change their position. (10/10 test cases pass) ex: Geeta after reversing would be ateeg. Here second ‘e’ at index 2 didn’t change its position. So the output is 1. The <strong>second question</strong> was pattern matching. Brute force was also good as constraints were a little easy. But the crust of the question was that we don’t have to consider the case of words i.e. T==t in string. So we have to convert either the strings to upper case or lower case.(16/16 test cases passed).</p><p>I cleared the coding round and was selected for the next round which was on 24th July.</p><p>The first TR was around 30 minutes where the interviewer first introduced himself and then asked for my introduction. After the introduction, he asked me to explain any one of the mentioned projects (I explained my project well and he was satisfied with my explanation). After that, he asked about 7 layers of the OSI Model, 1 string question for which I had to explain logic along with an explanation of the test case. Later, he asked me about Memory Management from OS, any AI tool that I use and for what purpose(I told ChatGPT for study purposes), my aim, and vision, and what principle I follow in life.</p><p>TR-1 went well and I was selected for TR-2 which was also scheduled on the same day(in the afternoon around 3 pm).</p><p>The second TR was around 1hr(just in my case, others had their second round only for 30 minutes). The interview started with an introduction and then asked for my introduction too. After that interviewer started a discussion about Projects on Machine learning(mentioned in my resume, he mainly focussed on another project that I didn’t explain in the first round), asked a few questions about my internship which I was doing and asked me to tell the difference between C++ and Java and Python (for difference my answer was not bookish I told him the difference with my perspective and for the purpose I used these languages and he was okay with). He then gave me a coding problem and the question was to move all zeroes to the end of the array<strong>. </strong>I was able to solve it. He also asked me to write down code on a copy and show the code on the camera. He gave me a puzzle. I was not able to do the puzzle completely. He also asked about the SDLC life cycle, SQL query basics, difference between algorithm and pseudocode.</p><p>I qualified for TR-2 also and was qualified for the final HR/Managerial round which was scheduled the next day.</p><p>This round was short around 20 minutes. He asked me whether I would be able to manage my time, a few questions about the Scholar@SAP program, and about various certifications that I mentioned in my resume. He was quite happy with my resume. In this round, you have to be optimistic about the company and its program and should answer every question with confidence.</p><p><strong>Final Result: Selected</strong> (result was declared on the same day in the evening)</p><p>It feels amazing when you grab your first job. I hope my interview experience will help the other candidates get their jobs.</p><p><strong>CONCLUSION:</strong></p><blockquote>Learn 1 technology atleast and make some project on it on your own so you are well versed with project details.</blockquote><blockquote>Revise CS fundamentals(OS,CN,DBMS) before interview.</blockquote><blockquote>For coding problems if you are consistent, simply solve previous SAP LABS question from <a href="https://www.geeksforgeeks.org/explore?page=1&amp;company=SAP%20Labs&amp;sortBy=submissions&amp;itm_source=geeksforgeeks&amp;itm_medium=main_header&amp;itm_campaign=practice_header">GFG</a>.</blockquote><blockquote>Be Confident, show your positive attitude towards company and their program.</blockquote><blockquote>All the interviewers were very friendly, they will make you feel calm and relaxed and you will be able to express your thoughts easily.</blockquote><blockquote>SAP LABS is a wonderful company in every terms, if you get offer take it without hesitation.</blockquote><p>For more captivating interview experiences, make sure to hit the <strong>like</strong> and <strong>follow </strong>button.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=184e10116382" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>