<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Swayam Blog</title>
    <link>/</link>
    <description>Recent content on Swayam Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sun, 02 Feb 2025 00:00:00 +0000</lastBuildDate><atom:link href="/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Basic Overview of DSA</title>
      <link>/posts/dsa/basic-overview-of-dsa/</link>
      <pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/dsa/basic-overview-of-dsa/</guid>
      <description>&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Arrays&lt;/strong&gt;: Linear data structure with a fixed size, allowing random access to elements.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Best for: Static datasets with frequent element access.&lt;/li&gt;
&lt;li&gt;Complexity:
&lt;ul&gt;
&lt;li&gt;Access: O(1)&lt;/li&gt;
&lt;li&gt;Search: O(n)&lt;/li&gt;
&lt;li&gt;Insertion/Deletion: O(n)
&lt;a href=&#34;/posts/dsa/array/&#34;&gt;Array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Linked Lists&lt;/strong&gt;: Linear structure of nodes, where each node points to the next.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Types: Singly, Doubly, Circular.&lt;/li&gt;
&lt;li&gt;Best for: Dynamic datasets with frequent insertions/deletions.&lt;/li&gt;
&lt;li&gt;Complexity:
&lt;ul&gt;
&lt;li&gt;Access/Search: O(n)&lt;/li&gt;
&lt;li&gt;Insertion/Deletion: O(1) (at head/tail with pointer)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Hash Maps (or Hash Tables)&lt;/strong&gt;: Key-value pair storage with a hash function.&lt;/p&gt;</description>
      <content>&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Arrays&lt;/strong&gt;: Linear data structure with a fixed size, allowing random access to elements.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Best for: Static datasets with frequent element access.&lt;/li&gt;
&lt;li&gt;Complexity:
&lt;ul&gt;
&lt;li&gt;Access: O(1)&lt;/li&gt;
&lt;li&gt;Search: O(n)&lt;/li&gt;
&lt;li&gt;Insertion/Deletion: O(n)
&lt;a href=&#34;/posts/dsa/array/&#34;&gt;Array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Linked Lists&lt;/strong&gt;: Linear structure of nodes, where each node points to the next.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Types: Singly, Doubly, Circular.&lt;/li&gt;
&lt;li&gt;Best for: Dynamic datasets with frequent insertions/deletions.&lt;/li&gt;
&lt;li&gt;Complexity:
&lt;ul&gt;
&lt;li&gt;Access/Search: O(n)&lt;/li&gt;
&lt;li&gt;Insertion/Deletion: O(1) (at head/tail with pointer)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Hash Maps (or Hash Tables)&lt;/strong&gt;: Key-value pair storage with a hash function.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Best for: Quick lookup and insertion.&lt;/li&gt;
&lt;li&gt;Complexity:
&lt;ul&gt;
&lt;li&gt;Average: O(1)&lt;/li&gt;
&lt;li&gt;Worst-case: O(n)(due to hash collisions)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Stacks&lt;/strong&gt;: LIFO (Last In, First Out) structure.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Operations: Push, Pop, Peek.&lt;/li&gt;
&lt;li&gt;Best for: Recursive problems, expression evaluation.&lt;/li&gt;
&lt;li&gt;Complexity:
&lt;ul&gt;
&lt;li&gt;Push/Pop/Peek: O(1)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Queues&lt;/strong&gt;: FIFO (First In, First Out) structure.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Variants: Circular Queue, Deque, Priority Queue.&lt;/li&gt;
&lt;li&gt;Best for: Scheduling, buffering.&lt;/li&gt;
&lt;li&gt;Complexity:
&lt;ul&gt;
&lt;li&gt;Enqueue/Dequeue: O(1)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Trees&lt;/strong&gt;: Hierarchical structure with nodes (root, parent, children).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Types: Binary, Binary Search Tree (BST), AVL, Red-Black, etc.&lt;/li&gt;
&lt;li&gt;Best for: Hierarchical data, searching/sorting.&lt;/li&gt;
&lt;li&gt;Complexity:
&lt;ul&gt;
&lt;li&gt;Search/Insert/Delete: O(h), where h is the tree height.&lt;/li&gt;
&lt;li&gt;Balanced trees maintain h=O(logn).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Graphs&lt;/strong&gt;: Collection of nodes (vertices) connected by edges.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Types: Directed, Undirected, Weighted, Unweighted.&lt;/li&gt;
&lt;li&gt;Representation: Adjacency Matrix/List.&lt;/li&gt;
&lt;li&gt;Best for: Network problems, pathfinding.&lt;/li&gt;
&lt;li&gt;Algorithms: DFS, BFS, Dijkstra’s, Prim’s, Kruskal’s.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
    </item>
    
    <item>
      <title>Array</title>
      <link>/posts/dsa/array/array/</link>
      <pubDate>Sun, 02 Feb 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/dsa/array/array/</guid>
      <description>&lt;h3 id=&#34;1-sorting-algorithms&#34;&gt;&lt;strong&gt;1. Sorting Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Sorting arranges elements in a specific order (ascending or descending).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bubble Sort&lt;/strong&gt; – Repeatedly swaps adjacent elements if they are in the wrong order.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Selection Sort&lt;/strong&gt; – Selects the smallest/largest element and places it in order.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Insertion Sort&lt;/strong&gt; – Builds the sorted array one element at a time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Merge Sort&lt;/strong&gt; – Uses the divide-and-conquer technique to sort.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quick Sort&lt;/strong&gt; – Selects a pivot and partitions elements around it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Heap Sort&lt;/strong&gt; – Uses a binary heap to sort efficiently.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Radix Sort&lt;/strong&gt; – Sorts numbers digit by digit.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Counting Sort&lt;/strong&gt; – Counts occurrences of elements (used for small range values).&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/posts/dsa/array/sorting/&#34;&gt;Sorting&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;2-searching-algorithms&#34;&gt;&lt;strong&gt;2. Searching Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Used to find an element in an array.&lt;/p&gt;</description>
      <content>&lt;h3 id=&#34;1-sorting-algorithms&#34;&gt;&lt;strong&gt;1. Sorting Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Sorting arranges elements in a specific order (ascending or descending).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bubble Sort&lt;/strong&gt; – Repeatedly swaps adjacent elements if they are in the wrong order.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Selection Sort&lt;/strong&gt; – Selects the smallest/largest element and places it in order.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Insertion Sort&lt;/strong&gt; – Builds the sorted array one element at a time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Merge Sort&lt;/strong&gt; – Uses the divide-and-conquer technique to sort.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quick Sort&lt;/strong&gt; – Selects a pivot and partitions elements around it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Heap Sort&lt;/strong&gt; – Uses a binary heap to sort efficiently.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Radix Sort&lt;/strong&gt; – Sorts numbers digit by digit.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Counting Sort&lt;/strong&gt; – Counts occurrences of elements (used for small range values).&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/posts/dsa/array/sorting/&#34;&gt;Sorting&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;2-searching-algorithms&#34;&gt;&lt;strong&gt;2. Searching Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Used to find an element in an array.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Linear Search&lt;/strong&gt; – Searches sequentially from start to end.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Binary Search&lt;/strong&gt; – Searches in a sorted array by dividing it into halves.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Jump Search&lt;/strong&gt; – Jumps ahead by fixed steps and performs a linear search.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interpolation Search&lt;/strong&gt; – Improved binary search that assumes a uniform distribution of values.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Exponential Search&lt;/strong&gt; – Useful for searching in unbounded or infinite-sized arrays.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/posts/dsa/array/searching/&#34;&gt;Searching&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;3-two-pointer-techniques&#34;&gt;&lt;strong&gt;3. Two-Pointer Techniques&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Used for problems requiring element comparison or sum-based conditions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Two-Sum Problem&lt;/strong&gt; – Find two numbers in an array that add up to a target.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Three-Sum Problem&lt;/strong&gt; – Find three numbers that sum to a target.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dutch National Flag Algorithm&lt;/strong&gt; – Used for sorting arrays with three types of elements (e.g., 0s, 1s, and 2s).&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;4-divide-and-conquer-algorithms&#34;&gt;&lt;strong&gt;4. Divide and Conquer Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Breaks the array into smaller parts, solves each, and merges results.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Merge Sort&lt;/strong&gt; – Recursively divides and merges sorted parts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quick Sort&lt;/strong&gt; – Uses a pivot to partition the array.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Binary Search&lt;/strong&gt; – Recursively searches a sorted array.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;5-greedy-algorithms&#34;&gt;&lt;strong&gt;5. Greedy Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Make the best choice at each step to find an optimal solution.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Activity Selection Problem&lt;/strong&gt; – Select maximum non-overlapping activities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interval Scheduling&lt;/strong&gt; – Schedule tasks with given constraints.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;6-sliding-window-algorithms&#34;&gt;&lt;strong&gt;6. Sliding Window Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Efficiently finds a subarray or subset in an array.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fixed Window Size&lt;/strong&gt; – Finds max/min sum of a subarray of size &lt;code&gt;k&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Variable Window Size&lt;/strong&gt; – Used for finding the smallest subarray with a sum ≥ target.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Maximum Sum Subarray (Kadane’s Algorithm)&lt;/strong&gt; – Finds the largest sum of contiguous subarrays.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;7-hashing-based-algorithms&#34;&gt;&lt;strong&gt;7. Hashing-Based Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Use hash tables for quick lookups and frequency counting.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Two Sum (Hash Map Approach)&lt;/strong&gt; – Stores values and looks for complements.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Subarray with Zero Sum&lt;/strong&gt; – Uses hashing to detect if a sum has occurred before.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Longest Consecutive Sequence&lt;/strong&gt; – Uses a hash set to track elements.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;8-dynamic-programming-dp-algorithms&#34;&gt;&lt;strong&gt;8. Dynamic Programming (DP) Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Used for optimization problems.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Longest Increasing Subsequence (LIS)&lt;/strong&gt; – Finds the longest increasing sequence.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;0/1 Knapsack Problem&lt;/strong&gt; – Determines the best way to pack items into a knapsack.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Subset Sum Problem&lt;/strong&gt; – Finds if a subset with a given sum exists.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Coin Change Problem&lt;/strong&gt; – Finds the minimum number of coins for a given amount.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;9-matrix-manipulation-algorithms&#34;&gt;&lt;strong&gt;9. Matrix Manipulation Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Arrays can be represented as matrices for solving problems.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rotate a Matrix (90 degrees, 180 degrees, etc.)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Spiral Order Traversal&lt;/strong&gt; – Traverse a 2D array in a spiral.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Flood Fill Algorithm&lt;/strong&gt; – Used in image processing (similar to DFS/BFS).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pathfinding (Dijkstra’s, Floyd-Warshall, etc.)&lt;/strong&gt; – Find shortest paths in graphs represented as matrices.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;10-bit-manipulation-algorithms&#34;&gt;&lt;strong&gt;10. Bit Manipulation Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Use bitwise operations to solve problems efficiently.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Finding the Single Non-Repeating Element (XOR Trick)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Counting Set Bits (Brian Kernighan’s Algorithm)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Subsets using Bitmasking&lt;/strong&gt; – Generate all subsets using bitwise operations.&lt;/li&gt;
&lt;/ul&gt;
</content>
    </item>
    
    <item>
      <title>Searching</title>
      <link>/posts/dsa/array/searching/</link>
      <pubDate>Sun, 02 Feb 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/dsa/array/searching/</guid>
      <description>&lt;h3 id=&#34;1-linear-search&#34;&gt;&lt;strong&gt;1. Linear Search&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Sequentially checks each element in the array.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Best: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Worst: &lt;strong&gt;O(n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Average: &lt;strong&gt;O(n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Space Complexity:&lt;/strong&gt; &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;2-binary-search-for-sorted-arrays-only&#34;&gt;&lt;strong&gt;2. Binary Search (For Sorted Arrays Only)&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Repeatedly divides the array in half and searches in the relevant half.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Best: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Worst: &lt;strong&gt;O(log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Average: &lt;strong&gt;O(log n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Space Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;O(1)&lt;/strong&gt; (Iterative)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;O(log n)&lt;/strong&gt; (Recursive, due to function call stack)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;3-jump-search-for-sorted-arrays&#34;&gt;&lt;strong&gt;3. Jump Search (For Sorted Arrays)&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Jumps ahead by a block size (√n) and does a linear search within that block.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Best: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Worst: &lt;strong&gt;O(√n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Average: &lt;strong&gt;O(√n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Space Complexity:&lt;/strong&gt; &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;4-interpolation-search-for-uniformly-distributed-sorted-data&#34;&gt;&lt;strong&gt;4. Interpolation Search (For Uniformly Distributed Sorted Data)&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Uses the formula to estimate the probable position of the target.
$$
pos=left+ \frac {(target−arr[left])×(right−left)}{(arr[right]−arr[left])}​
$$&lt;/p&gt;</description>
      <content>&lt;h3 id=&#34;1-linear-search&#34;&gt;&lt;strong&gt;1. Linear Search&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Sequentially checks each element in the array.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Best: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Worst: &lt;strong&gt;O(n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Average: &lt;strong&gt;O(n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Space Complexity:&lt;/strong&gt; &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;2-binary-search-for-sorted-arrays-only&#34;&gt;&lt;strong&gt;2. Binary Search (For Sorted Arrays Only)&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Repeatedly divides the array in half and searches in the relevant half.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Best: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Worst: &lt;strong&gt;O(log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Average: &lt;strong&gt;O(log n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Space Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;O(1)&lt;/strong&gt; (Iterative)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;O(log n)&lt;/strong&gt; (Recursive, due to function call stack)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;3-jump-search-for-sorted-arrays&#34;&gt;&lt;strong&gt;3. Jump Search (For Sorted Arrays)&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Jumps ahead by a block size (√n) and does a linear search within that block.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Best: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Worst: &lt;strong&gt;O(√n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Average: &lt;strong&gt;O(√n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Space Complexity:&lt;/strong&gt; &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;4-interpolation-search-for-uniformly-distributed-sorted-data&#34;&gt;&lt;strong&gt;4. Interpolation Search (For Uniformly Distributed Sorted Data)&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Uses the formula to estimate the probable position of the target.
$$
pos=left+ \frac {(target−arr[left])×(right−left)}{(arr[right]−arr[left])}​
$$&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Best: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Worst: &lt;strong&gt;O(n)&lt;/strong&gt; (when data is skewed)&lt;/li&gt;
&lt;li&gt;Average: &lt;strong&gt;O(log log n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Space Complexity:&lt;/strong&gt; &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;5-exponential-search-for-unbounded-sorted-arrays&#34;&gt;&lt;strong&gt;5. Exponential Search (For Unbounded Sorted Arrays)&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Starts with small steps (1, 2, 4, 8…) to find a suitable range, then uses Binary Search.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Best: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Worst: &lt;strong&gt;O(log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Average: &lt;strong&gt;O(log n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Space Complexity:&lt;/strong&gt; &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;6-fibonacci-search-for-sorted-arrays&#34;&gt;&lt;strong&gt;6. Fibonacci Search (For Sorted Arrays)&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Uses Fibonacci numbers instead of dividing by 2 like Binary Search.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time Complexity:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Best: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Worst: &lt;strong&gt;O(log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Average: &lt;strong&gt;O(log n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Space Complexity:&lt;/strong&gt; &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;comparison-table&#34;&gt;&lt;strong&gt;Comparison Table&lt;/strong&gt;&lt;/h2&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Algorithm&lt;/th&gt;
          &lt;th&gt;Best Case&lt;/th&gt;
          &lt;th&gt;Worst Case&lt;/th&gt;
          &lt;th&gt;Average Case&lt;/th&gt;
          &lt;th&gt;Space Complexity&lt;/th&gt;
          &lt;th&gt;Sorted Array Required?&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;strong&gt;Linear Search&lt;/strong&gt;&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;O(n)&lt;/td&gt;
          &lt;td&gt;O(n)&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;No&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;strong&gt;Binary Search&lt;/strong&gt;&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;O(log n)&lt;/td&gt;
          &lt;td&gt;O(log n)&lt;/td&gt;
          &lt;td&gt;O(1) / O(log n)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;strong&gt;Jump Search&lt;/strong&gt;&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;O(√n)&lt;/td&gt;
          &lt;td&gt;O(√n)&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;strong&gt;Interpolation Search&lt;/strong&gt;&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;O(n)&lt;/td&gt;
          &lt;td&gt;O(log log n)&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;strong&gt;Exponential Search&lt;/strong&gt;&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;O(log n)&lt;/td&gt;
          &lt;td&gt;O(log n)&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;strong&gt;Fibonacci Search&lt;/strong&gt;&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;O(log n)&lt;/td&gt;
          &lt;td&gt;O(log n)&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
</content>
    </item>
    
    <item>
      <title>Sorting</title>
      <link>/posts/dsa/array/sorting/</link>
      <pubDate>Sat, 01 Feb 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/dsa/array/sorting/</guid>
      <description>&lt;h2 id=&#34;sort&#34;&gt;Sort&lt;/h2&gt;
&lt;h3 id=&#34;1-comparison-based-sorting&#34;&gt;&lt;strong&gt;1. Comparison-Based Sorting&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;These algorithms compare elements to determine their order.&lt;/p&gt;
&lt;h4 id=&#34;a-bubble-sort&#34;&gt;&lt;strong&gt;a. Bubble Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Repeatedly swaps adjacent elements if they are in the wrong order.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n²)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;b-selection-sort&#34;&gt;&lt;strong&gt;b. Selection Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Finds the smallest element and places it in the correct position.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n²)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;c-insertion-sort&#34;&gt;&lt;strong&gt;c. Insertion Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Picks one element at a time and places it in its correct position.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n²)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Efficient for small or nearly sorted data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;d-merge-sort-divide-and-conquer&#34;&gt;&lt;strong&gt;d. Merge Sort&lt;/strong&gt; (Divide and Conquer)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Divides the array into halves, sorts them, and merges them.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;e-quick-sort-divide-and-conquer&#34;&gt;&lt;strong&gt;e. Quick Sort&lt;/strong&gt; (Divide and Conquer)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Picks a pivot, partitions the array, and sorts recursively.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt; (Best &amp;amp; Avg), &lt;strong&gt;O(n²)&lt;/strong&gt; (Worst)&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(log n)&lt;/strong&gt; (due to recursion)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;f-heap-sort&#34;&gt;&lt;strong&gt;f. Heap Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Converts the array into a heap and extracts elements in order.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;g-shell-sort&#34;&gt;&lt;strong&gt;g. Shell Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Variation of insertion sort that sorts elements at a gap.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt; (Best), &lt;strong&gt;O(n²)&lt;/strong&gt; (Worst)&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;2-non-comparison-based-sorting&#34;&gt;&lt;strong&gt;2. Non-Comparison-Based Sorting&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;These algorithms do not compare elements directly.&lt;/p&gt;</description>
      <content>&lt;h2 id=&#34;sort&#34;&gt;Sort&lt;/h2&gt;
&lt;h3 id=&#34;1-comparison-based-sorting&#34;&gt;&lt;strong&gt;1. Comparison-Based Sorting&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;These algorithms compare elements to determine their order.&lt;/p&gt;
&lt;h4 id=&#34;a-bubble-sort&#34;&gt;&lt;strong&gt;a. Bubble Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Repeatedly swaps adjacent elements if they are in the wrong order.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n²)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;b-selection-sort&#34;&gt;&lt;strong&gt;b. Selection Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Finds the smallest element and places it in the correct position.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n²)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;c-insertion-sort&#34;&gt;&lt;strong&gt;c. Insertion Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Picks one element at a time and places it in its correct position.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n²)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Efficient for small or nearly sorted data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;d-merge-sort-divide-and-conquer&#34;&gt;&lt;strong&gt;d. Merge Sort&lt;/strong&gt; (Divide and Conquer)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Divides the array into halves, sorts them, and merges them.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;e-quick-sort-divide-and-conquer&#34;&gt;&lt;strong&gt;e. Quick Sort&lt;/strong&gt; (Divide and Conquer)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Picks a pivot, partitions the array, and sorts recursively.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt; (Best &amp;amp; Avg), &lt;strong&gt;O(n²)&lt;/strong&gt; (Worst)&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(log n)&lt;/strong&gt; (due to recursion)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;f-heap-sort&#34;&gt;&lt;strong&gt;f. Heap Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Converts the array into a heap and extracts elements in order.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;g-shell-sort&#34;&gt;&lt;strong&gt;g. Shell Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Variation of insertion sort that sorts elements at a gap.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt; (Best), &lt;strong&gt;O(n²)&lt;/strong&gt; (Worst)&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(1)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;2-non-comparison-based-sorting&#34;&gt;&lt;strong&gt;2. Non-Comparison-Based Sorting&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;These algorithms do not compare elements directly.&lt;/p&gt;
&lt;h4 id=&#34;a-counting-sort&#34;&gt;&lt;strong&gt;a. Counting Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Counts occurrences of elements and places them in sorted order.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n + k)&lt;/strong&gt; (k is range of numbers)&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(k)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Works only for integer values with a known range.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;b-radix-sort&#34;&gt;&lt;strong&gt;b. Radix Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Sorts numbers digit by digit using counting sort as a subroutine.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(nk)&lt;/strong&gt; (k is number of digits)&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(n + k)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Works well for fixed-size numbers like integers.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;c-bucket-sort&#34;&gt;&lt;strong&gt;c. Bucket Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Divides elements into buckets and sorts each bucket individually.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n + k)&lt;/strong&gt; (depends on bucket distribution)&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(n + k)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Works well for uniformly distributed data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;3-hybrid-sorting-algorithms&#34;&gt;&lt;strong&gt;3. Hybrid Sorting Algorithms&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;These algorithms combine multiple sorting techniques.&lt;/p&gt;
&lt;h4 id=&#34;a-tim-sort&#34;&gt;&lt;strong&gt;a. Tim Sort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Combination of Merge Sort and Insertion Sort.&lt;/li&gt;
&lt;li&gt;Used in Python’s built-in sorting (&lt;code&gt;sorted()&lt;/code&gt; and &lt;code&gt;.sort()&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;b-introsort&#34;&gt;&lt;strong&gt;b. Introsort&lt;/strong&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Hybrid of Quick Sort, Heap Sort, and Insertion Sort.&lt;/li&gt;
&lt;li&gt;Used in C++ STL &lt;code&gt;sort()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Time Complexity: &lt;strong&gt;O(n log n)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Space Complexity: &lt;strong&gt;O(log n)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;choosing-the-right-sorting-algorithm&#34;&gt;&lt;strong&gt;Choosing the Right Sorting Algorithm&lt;/strong&gt;&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Algorithm&lt;/th&gt;
          &lt;th&gt;Best Case&lt;/th&gt;
          &lt;th&gt;Worst Case&lt;/th&gt;
          &lt;th&gt;Average Case&lt;/th&gt;
          &lt;th&gt;Space Complexity&lt;/th&gt;
          &lt;th&gt;Stable?&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Bubble Sort&lt;/td&gt;
          &lt;td&gt;O(n)&lt;/td&gt;
          &lt;td&gt;O(n²)&lt;/td&gt;
          &lt;td&gt;O(n²)&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Selection Sort&lt;/td&gt;
          &lt;td&gt;O(n²)&lt;/td&gt;
          &lt;td&gt;O(n²)&lt;/td&gt;
          &lt;td&gt;O(n²)&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;No&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Insertion Sort&lt;/td&gt;
          &lt;td&gt;O(n)&lt;/td&gt;
          &lt;td&gt;O(n²)&lt;/td&gt;
          &lt;td&gt;O(n²)&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Merge Sort&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(n)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Quick Sort&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(n²)&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(log n)&lt;/td&gt;
          &lt;td&gt;No&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Heap Sort&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(1)&lt;/td&gt;
          &lt;td&gt;No&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Counting Sort&lt;/td&gt;
          &lt;td&gt;O(n + k)&lt;/td&gt;
          &lt;td&gt;O(n + k)&lt;/td&gt;
          &lt;td&gt;O(n + k)&lt;/td&gt;
          &lt;td&gt;O(k)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Radix Sort&lt;/td&gt;
          &lt;td&gt;O(nk)&lt;/td&gt;
          &lt;td&gt;O(nk)&lt;/td&gt;
          &lt;td&gt;O(nk)&lt;/td&gt;
          &lt;td&gt;O(n + k)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Bucket Sort&lt;/td&gt;
          &lt;td&gt;O(n + k)&lt;/td&gt;
          &lt;td&gt;O(n²)&lt;/td&gt;
          &lt;td&gt;O(n)&lt;/td&gt;
          &lt;td&gt;O(n + k)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Tim Sort&lt;/td&gt;
          &lt;td&gt;O(n)&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(n log n)&lt;/td&gt;
          &lt;td&gt;O(n)&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
</content>
    </item>
    
    <item>
      <title>My Road map for cyber security</title>
      <link>/posts/cyber-security/my-road-map-for-cyber-security/</link>
      <pubDate>Sun, 26 Jan 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/cyber-security/my-road-map-for-cyber-security/</guid>
      <description>&lt;h2 id=&#34;month-1-3-foundations&#34;&gt;Month 1-3: Foundations&lt;/h2&gt;
&lt;h3 id=&#34;networking-fundamentals&#34;&gt;Networking Fundamentals&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Learn TCP/IP, OSI model, and common protocols&lt;/li&gt;
&lt;li&gt;Study network topologies and architecture&lt;/li&gt;
&lt;li&gt;Practice with tools like Wireshark for packet analysis&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;linux-essentials&#34;&gt;Linux Essentials&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Install a Linux distribution (e.g., Ubuntu or Kali Linux)&lt;/li&gt;
&lt;li&gt;Master basic command-line operations&lt;/li&gt;
&lt;li&gt;Learn file system structure and permissions&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;programming-basics&#34;&gt;Programming Basics&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Start with Python for cybersecurity&lt;/li&gt;
&lt;li&gt;Learn basic scripting for automation&lt;/li&gt;
&lt;li&gt;Practice with simple security-related coding projects&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;month-4-6-core-security-concepts&#34;&gt;Month 4-6: Core Security Concepts&lt;/h2&gt;
&lt;h3 id=&#34;information-security-principles&#34;&gt;Information Security Principles&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Study CIA triad (Confidentiality, Integrity, Availability)&lt;/li&gt;
&lt;li&gt;Learn about access control models and authentication methods&lt;/li&gt;
&lt;li&gt;Understand basic cryptography concepts&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;web-application-security&#34;&gt;Web Application Security&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Learn common web vulnerabilities (e.g., OWASP Top 10)&lt;/li&gt;
&lt;li&gt;Practice identifying and exploiting basic web app flaws&lt;/li&gt;
&lt;li&gt;Study secure coding practices&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;network-security&#34;&gt;Network Security&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Understand firewalls, IDS/IPS, and VPNs&lt;/li&gt;
&lt;li&gt;Learn about common network attacks and defenses&lt;/li&gt;
&lt;li&gt;Practice configuring basic network security tools&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;month-7-9-specialization-and-practical-skills&#34;&gt;Month 7-9: Specialization and Practical Skills&lt;/h2&gt;
&lt;h3 id=&#34;ethical-hacking-basics&#34;&gt;Ethical Hacking Basics&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Study penetration testing methodologies&lt;/li&gt;
&lt;li&gt;Learn about reconnaissance and scanning techniques&lt;/li&gt;
&lt;li&gt;Practice with vulnerable virtual machines (e.g., DVWA, Metasploitable)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;incident-response-and-forensics&#34;&gt;Incident Response and Forensics&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Understand the incident response lifecycle&lt;/li&gt;
&lt;li&gt;Learn basic digital forensics techniques&lt;/li&gt;
&lt;li&gt;Practice with forensic tools like Autopsy or EnCase&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;cloud-security&#34;&gt;Cloud Security&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Study cloud service models (IaaS, PaaS, SaaS)&lt;/li&gt;
&lt;li&gt;Learn about shared responsibility models&lt;/li&gt;
&lt;li&gt;Practice securing cloud environments (e.g., AWS, Azure)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;month-10-12-advanced-topics-and-career-preparation&#34;&gt;Month 10-12: Advanced Topics and Career Preparation&lt;/h2&gt;
&lt;h3 id=&#34;threat-intelligence&#34;&gt;Threat Intelligence&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Learn about threat actors and their motivations&lt;/li&gt;
&lt;li&gt;Study threat intelligence platforms and feeds&lt;/li&gt;
&lt;li&gt;Practice creating threat intelligence reports&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;governance-risk-and-compliance&#34;&gt;Governance, Risk, and Compliance&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Understand common security frameworks (e.g., NIST, ISO 27001)&lt;/li&gt;
&lt;li&gt;Learn about risk assessment methodologies&lt;/li&gt;
&lt;li&gt;Study relevant regulations (e.g., GDPR, HIPAA)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;career-development&#34;&gt;Career Development&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Build a professional network (join cybersecurity communities, attend webinars)&lt;/li&gt;
&lt;li&gt;Create a portfolio of projects and write-ups&lt;/li&gt;
&lt;li&gt;Prepare for entry-level cybersecurity certifications (e.g., CompTIA Security+)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Throughout the year:&lt;/p&gt;</description>
      <content>&lt;h2 id=&#34;month-1-3-foundations&#34;&gt;Month 1-3: Foundations&lt;/h2&gt;
&lt;h3 id=&#34;networking-fundamentals&#34;&gt;Networking Fundamentals&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Learn TCP/IP, OSI model, and common protocols&lt;/li&gt;
&lt;li&gt;Study network topologies and architecture&lt;/li&gt;
&lt;li&gt;Practice with tools like Wireshark for packet analysis&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;linux-essentials&#34;&gt;Linux Essentials&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Install a Linux distribution (e.g., Ubuntu or Kali Linux)&lt;/li&gt;
&lt;li&gt;Master basic command-line operations&lt;/li&gt;
&lt;li&gt;Learn file system structure and permissions&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;programming-basics&#34;&gt;Programming Basics&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Start with Python for cybersecurity&lt;/li&gt;
&lt;li&gt;Learn basic scripting for automation&lt;/li&gt;
&lt;li&gt;Practice with simple security-related coding projects&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;month-4-6-core-security-concepts&#34;&gt;Month 4-6: Core Security Concepts&lt;/h2&gt;
&lt;h3 id=&#34;information-security-principles&#34;&gt;Information Security Principles&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Study CIA triad (Confidentiality, Integrity, Availability)&lt;/li&gt;
&lt;li&gt;Learn about access control models and authentication methods&lt;/li&gt;
&lt;li&gt;Understand basic cryptography concepts&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;web-application-security&#34;&gt;Web Application Security&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Learn common web vulnerabilities (e.g., OWASP Top 10)&lt;/li&gt;
&lt;li&gt;Practice identifying and exploiting basic web app flaws&lt;/li&gt;
&lt;li&gt;Study secure coding practices&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;network-security&#34;&gt;Network Security&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Understand firewalls, IDS/IPS, and VPNs&lt;/li&gt;
&lt;li&gt;Learn about common network attacks and defenses&lt;/li&gt;
&lt;li&gt;Practice configuring basic network security tools&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;month-7-9-specialization-and-practical-skills&#34;&gt;Month 7-9: Specialization and Practical Skills&lt;/h2&gt;
&lt;h3 id=&#34;ethical-hacking-basics&#34;&gt;Ethical Hacking Basics&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Study penetration testing methodologies&lt;/li&gt;
&lt;li&gt;Learn about reconnaissance and scanning techniques&lt;/li&gt;
&lt;li&gt;Practice with vulnerable virtual machines (e.g., DVWA, Metasploitable)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;incident-response-and-forensics&#34;&gt;Incident Response and Forensics&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Understand the incident response lifecycle&lt;/li&gt;
&lt;li&gt;Learn basic digital forensics techniques&lt;/li&gt;
&lt;li&gt;Practice with forensic tools like Autopsy or EnCase&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;cloud-security&#34;&gt;Cloud Security&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Study cloud service models (IaaS, PaaS, SaaS)&lt;/li&gt;
&lt;li&gt;Learn about shared responsibility models&lt;/li&gt;
&lt;li&gt;Practice securing cloud environments (e.g., AWS, Azure)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;month-10-12-advanced-topics-and-career-preparation&#34;&gt;Month 10-12: Advanced Topics and Career Preparation&lt;/h2&gt;
&lt;h3 id=&#34;threat-intelligence&#34;&gt;Threat Intelligence&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Learn about threat actors and their motivations&lt;/li&gt;
&lt;li&gt;Study threat intelligence platforms and feeds&lt;/li&gt;
&lt;li&gt;Practice creating threat intelligence reports&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;governance-risk-and-compliance&#34;&gt;Governance, Risk, and Compliance&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Understand common security frameworks (e.g., NIST, ISO 27001)&lt;/li&gt;
&lt;li&gt;Learn about risk assessment methodologies&lt;/li&gt;
&lt;li&gt;Study relevant regulations (e.g., GDPR, HIPAA)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;career-development&#34;&gt;Career Development&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Build a professional network (join cybersecurity communities, attend webinars)&lt;/li&gt;
&lt;li&gt;Create a portfolio of projects and write-ups&lt;/li&gt;
&lt;li&gt;Prepare for entry-level cybersecurity certifications (e.g., CompTIA Security+)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Throughout the year:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stay updated with cybersecurity news and trends&lt;/li&gt;
&lt;li&gt;Participate in Capture The Flag (CTF) competitions&lt;/li&gt;
&lt;li&gt;Contribute to open-source security projects&lt;/li&gt;
&lt;li&gt;Practice ethical hacking on platforms like Hack-The-Box or Try-Hack-Me&lt;/li&gt;
&lt;/ul&gt;
</content>
    </item>
    
    <item>
      <title>Network</title>
      <link>/posts/cyber-security/network/</link>
      <pubDate>Thu, 02 Jan 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/cyber-security/network/</guid>
      <description>&lt;h1 id=&#34;what-is-computer-networking&#34;&gt;What is computer networking?&lt;/h1&gt;
&lt;p&gt;Networking, or computer networking, is the process of connecting two or more computing devices, such as desktop computers, mobile devices, routers or applications, to enable the transmission and exchange of information and resources.&lt;/p&gt;
&lt;p&gt;Networked devices rely on communications protocols—rules that describe how to transmit or exchange data across a network—to share information over physical or wireless connections.&lt;/p&gt;
&lt;h1 id=&#34;key-networking-components-and-devices&#34;&gt;Key networking components and devices&lt;/h1&gt;
&lt;p&gt;Before we delve into more complex networking topics, it’s important to understand fundamental networking components, including:&lt;/p&gt;</description>
      <content>&lt;h1 id=&#34;what-is-computer-networking&#34;&gt;What is computer networking?&lt;/h1&gt;
&lt;p&gt;Networking, or computer networking, is the process of connecting two or more computing devices, such as desktop computers, mobile devices, routers or applications, to enable the transmission and exchange of information and resources.&lt;/p&gt;
&lt;p&gt;Networked devices rely on communications protocols—rules that describe how to transmit or exchange data across a network—to share information over physical or wireless connections.&lt;/p&gt;
&lt;h1 id=&#34;key-networking-components-and-devices&#34;&gt;Key networking components and devices&lt;/h1&gt;
&lt;p&gt;Before we delve into more complex networking topics, it’s important to understand fundamental networking components, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IP address:&lt;/strong&gt; An IP address is the unique number assigned to every network device in an Internet Protocol (IP) network; each IP address identifies the device’s host network and its location on the network. When one device sends data to another, the data includes a “header” that includes the IP addresses of both the sending and receiving devices.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Nodes:&lt;/strong&gt; A node is a network connection point that can receive, send, create or store data. It’s essentially any network device—computers, printers, modems, bridges or switches—that can recognize, process and transmit information to another network node. Each node requires some form of identification (such an IP or MAC address) to receive access to the network.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Routers:&lt;/strong&gt; A router is a physical or virtual device that sends data “packets” between networks. Routers analyze the data within packets to determine the best transmission path and use sophisticated routing algorithms to forward data packets until they reach their destination node.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Switches:&lt;/strong&gt; A switch is a device that connects network devices and manages node-to-node communication across a network, making sure that data packets reach their intended destination. Unlike routers, which send information &lt;em&gt;between&lt;/em&gt; networks, switches send information between nodes &lt;em&gt;within&lt;/em&gt; a network.&lt;/p&gt;
&lt;p&gt;Consequently, “switching” refers to how data is transferred between devices on a network. Networks rely on three main types of switching:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Circuit switching&lt;/em&gt; establishes a dedicated data communication path between nodes in a network, so no other traffic can traverse the same path. Circuit switching sees to it that full bandwidth is available during every transmission.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Message switching&lt;/em&gt; sends whole messages from the source node to the destination node, with the message traveling from switch to switch until it reaches the destination.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Packet switching&lt;/em&gt; involves breaking down data into independent components to make data transmission less demanding of network resources. With packet switching, packets—instead of entire data streams—travel through the network to their end destination.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ports:&lt;/strong&gt; A port indicates a specific connection between network devices, with each port identified by a number. If an IP address is analogous to a hotel address, then ports are the suites and room numbers. Computers use port numbers to determine which application, service or process should receive which messages.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Gateways:&lt;/strong&gt; Gateways are hardware devices that facilitate communication between two different networks. Routers, firewalls and other gateway devices use rate converters, protocol translators and other technologies to make inter-network communication possible between otherwise incompatible devices.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;network-types-by-communication-type&#34;&gt;Network types by communication type&lt;/h3&gt;
&lt;p&gt;Computing networks can transmit data using a range of transmission dynamics, including: 
Multipoint networks&lt;/p&gt;
&lt;h4 id=&#34;in-a-multipoint-network&#34;&gt;In a multipoint network,&lt;/h4&gt;
&lt;p&gt;multiple devices share channel capacity and network links.&lt;/p&gt;
&lt;h4 id=&#34;point-to-point-networks&#34;&gt;Point-to-point networks&lt;/h4&gt;
&lt;p&gt;Network devices establish a direct node-to-node link to transmit data.&lt;/p&gt;
&lt;h4 id=&#34;broadcast-networks&#34;&gt;Broadcast networks&lt;/h4&gt;
&lt;p&gt;On broadcast networks, several interested “parties” (devices) can receive one-way transmissions from a single sending device. Television stations are a great example of broadcast networks.&lt;/p&gt;
&lt;h4 id=&#34;virtual-private-networks-vpns&#34;&gt;Virtual private networks (VPNs)&lt;/h4&gt;
&lt;p&gt;A VPN is a secure, point-to-point connection between two network endpoints. It establishes an encrypted channel that keeps a user’s identity and access credentials, as well as any data transferred, inaccessible to hackers.&lt;/p&gt;
&lt;h1 id=&#34;network-communication-protocols&#34;&gt;Network communication protocols&lt;/h1&gt;
&lt;p&gt;Whether it’s the internet protocol (IP) suite, Ethernet, wireless LAN (WLAN) or cellular communication standards, all computer networks follow communication protocols—sets of rules that every node on the network must follow in order to share and receive data. Protocols also rely on gateways to enable incompatible devices to communicate (a Windows computer attempting to access Linux servers, for instance)&lt;/p&gt;
&lt;p&gt;Many modern networks run on TCP/IP models, which include four network layers.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Network access layer.&lt;/strong&gt; Also called the data link layer or the physical layer, the network access layer of a TCP/IP network includes the network &lt;a href=&#34;https://www.ibm.com/topics/infrastructure&#34;&gt;infrastructure&lt;/a&gt; (hardware and software components) necessary for interfacing with the network medium. It handles physical data transmission—using Ethernet and protocols such as the address resolution protocol (ARP)—between devices on the same network.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Internet layer.&lt;/strong&gt; The internet layer is responsible for logical addressing, routing and packet forwarding. It primarily relies on the IP protocol and the Internet Control Message Protocol (ICMP), which manages addressing and routing of packets across different networks.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transport layer.&lt;/strong&gt; The TCP/IP transport layer enables data transfer between upper and lower layers of the network. Using TCP and UDP protocols, it also provides mechanisms for error checking and flow control.&lt;/p&gt;
&lt;p&gt;TCP is a connection-based protocol that is generally slower but more reliable than UDP. UDP is a connectionless protocol that is faster than TCP but does not provide guaranteed transfer. UDP protocols facilitate packet transmission for time-sensitive apps (such as video streaming and gaming platforms) and DNS lookups.**&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Application layer.&lt;/strong&gt; TCP/IP’s application layer uses HTTP, FTP, Post Office Protocol 3 (POP3), SMTP, &lt;a href=&#34;https://www.ibm.com/topics/dns&#34;&gt;domain name system (DNS)&lt;/a&gt; and SSH protocols to provide network services directly to applications. It also manages all the protocols that support user applications&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;osi-model&#34;&gt;OSI Model&lt;/h1&gt;
&lt;p&gt;The Open Systems Interconnection (OSI) model—also called the OSI reference model—is a conceptual model that divides network communication and interoperability into seven abstract layers. It provides a standardized model that enables different applications, computer systems and networks to communicate.&lt;/p&gt;
&lt;p&gt;The OSI model emerged as a solution to communication incompatibilities between the diverse array of networking protocols in use around the turn of the century. The layers of OSI gave developers and engineers a framework for building interoperable hardware and software across networks by providing a categorical approach to &lt;a href=&#34;https://www.ibm.com/topics/networking&#34;&gt;networking&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;At each layer of the stack—typically shown in reverse order to illustrate how data moves through a network—the OSI model provides guidelines and criteria for network components and their unique computing functions.&lt;/p&gt;
&lt;p&gt;The layers are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Layer 7: The application layer initiates communication with the network, including the protocols and data manipulation processes that convert computer-readable network data into user-readable responses.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Layer 6: The presentation layer prepares data for the application layer, including data translation, compression and &lt;a href=&#34;https://www.ibm.com/topics/encryption&#34;&gt;encryption&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Layer 5: The session layer initiates and terminates connections between two devices interacting on the network, making sure that resources are neither overused nor underutilized.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Layer 4: The transport layer transmits end-to-end data between two devices interacting on the network, making sure that data isn’t lost, misconfigured or corrupted.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Layer 3: The network layer handles data addressing, routing and forwarding processes for devices interacting across different networks. If the devices are on the same network, they don’t need the network layer to interact.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Layer 2: Unlike the network layer, the data link layer manages data routing between two interacting devices on the same network.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Layer 1: The physical layer comprises the physical assets, like routers and USB cables, that convert data into strings of 1s and 0s for transmission to higher layers.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://www.ibm.com/topics/networking&#34;&gt;source1&lt;/a&gt;
&lt;a href=&#34;https://www.ibm.com/think/topics/osi-model&#34;&gt;source2&lt;/a&gt;
&lt;a href=&#34;https://en.wikipedia.org/wiki/OSI_model&#34;&gt;source3&lt;/a&gt;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Cyber Security</title>
      <link>/posts/cyber-security/cyber-security/</link>
      <pubDate>Sat, 28 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>/posts/cyber-security/cyber-security/</guid>
      <description>&lt;h1 id=&#34;hi-guys-lets-start-our-cyber-security-journey-is-from-today&#34;&gt;Hi guys lets Start our cyber security journey is From today&lt;/h1&gt;
&lt;h3 id=&#34;in-this-journey-we-are-going-to-learn-about-the-fundamentals-of-cyber-security&#34;&gt;In this Journey we are going to learn about the fundamentals of cyber security&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Programming for Cybersecurity&lt;/li&gt;
&lt;li&gt;Cybersecurity Basics&lt;/li&gt;
&lt;li&gt;Networking Fundamentals&lt;/li&gt;
&lt;li&gt;Operating Systems Security&lt;/li&gt;
&lt;li&gt;Cryptography&lt;/li&gt;
&lt;li&gt;Penetration Testing&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;i-am-thing-of-starting-form-c-and-c-as-they-are-low-level-languages-and-help-me-with-my-college-also-and-in-cyberspace-also&#34;&gt;I am thing of starting form c and c++ as they are low level languages and help me with my college also and in cyberspace also.&lt;/h3&gt;
&lt;h2 id=&#34;i-am-thing-of-complete-the-basic-in-12-months-so--that-i-can-get-some-internship-and-grow-my--self&#34;&gt;I am thing of complete the basic in 12 Months so  that i can get some internship and grow my  self.&lt;/h2&gt;
&lt;h2 id=&#34;lets-start-this-journey-of-mine-form-1-jan-2025-this-is-my-new-year-resolution-that-i-will-cyber-security-internship-by-the-end-of-this-year&#34;&gt;Lets start this Journey of mine form 1 Jan 2025 This is my new Year Resolution that I will Cyber Security internship by the end of this year.&lt;/h2&gt;
&lt;h2 id=&#34;i-am--think-of-posting-my-work-weekly-here-as-i-know-no-body-is-reading-this-this-but-it-helps-me-feel-motivated-to-do-the-work&#34;&gt;I am  think of Posting my work weekly here as i know no body is reading this this but it helps me feel motivated to do the work&lt;/h2&gt;
&lt;h2 id=&#34;thanks&#34;&gt;Thanks&lt;/h2&gt;</description>
      <content>&lt;h1 id=&#34;hi-guys-lets-start-our-cyber-security-journey-is-from-today&#34;&gt;Hi guys lets Start our cyber security journey is From today&lt;/h1&gt;
&lt;h3 id=&#34;in-this-journey-we-are-going-to-learn-about-the-fundamentals-of-cyber-security&#34;&gt;In this Journey we are going to learn about the fundamentals of cyber security&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Programming for Cybersecurity&lt;/li&gt;
&lt;li&gt;Cybersecurity Basics&lt;/li&gt;
&lt;li&gt;Networking Fundamentals&lt;/li&gt;
&lt;li&gt;Operating Systems Security&lt;/li&gt;
&lt;li&gt;Cryptography&lt;/li&gt;
&lt;li&gt;Penetration Testing&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;i-am-thing-of-starting-form-c-and-c-as-they-are-low-level-languages-and-help-me-with-my-college-also-and-in-cyberspace-also&#34;&gt;I am thing of starting form c and c++ as they are low level languages and help me with my college also and in cyberspace also.&lt;/h3&gt;
&lt;h2 id=&#34;i-am-thing-of-complete-the-basic-in-12-months-so--that-i-can-get-some-internship-and-grow-my--self&#34;&gt;I am thing of complete the basic in 12 Months so  that i can get some internship and grow my  self.&lt;/h2&gt;
&lt;h2 id=&#34;lets-start-this-journey-of-mine-form-1-jan-2025-this-is-my-new-year-resolution-that-i-will-cyber-security-internship-by-the-end-of-this-year&#34;&gt;Lets start this Journey of mine form 1 Jan 2025 This is my new Year Resolution that I will Cyber Security internship by the end of this year.&lt;/h2&gt;
&lt;h2 id=&#34;i-am--think-of-posting-my-work-weekly-here-as-i-know-no-body-is-reading-this-this-but-it-helps-me-feel-motivated-to-do-the-work&#34;&gt;I am  think of Posting my work weekly here as i know no body is reading this this but it helps me feel motivated to do the work&lt;/h2&gt;
&lt;h2 id=&#34;thanks&#34;&gt;Thanks&lt;/h2&gt;
</content>
    </item>
    
    <item>
      <title>My First blog</title>
      <link>/posts/my-first-blog/</link>
      <pubDate>Fri, 06 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>/posts/my-first-blog/</guid>
      <description>&lt;h2 id=&#34;this-is-my-first-blog-to-help-me--log-my-life-throughout-my-college-life&#34;&gt;This is my First blog to help me  log my life throughout my college life&lt;/h2&gt;
&lt;h2 id=&#34;so-lets-being&#34;&gt;So lets being&lt;/h2&gt;
&lt;p&gt;fuck you&lt;/p&gt;</description>
      <content>&lt;h2 id=&#34;this-is-my-first-blog-to-help-me--log-my-life-throughout-my-college-life&#34;&gt;This is my First blog to help me  log my life throughout my college life&lt;/h2&gt;
&lt;h2 id=&#34;so-lets-being&#34;&gt;So lets being&lt;/h2&gt;
&lt;p&gt;fuck you&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>About Me</title>
      <link>/about/</link>
      <pubDate>Thu, 05 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>/about/</guid>
      <description>&lt;p&gt;&lt;em&gt;Hi, I&amp;rsquo;m Swayam&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Welcome to my little corner of the internet! I’m a passionate learner and creator with a love for all things science, technology, and creativity. From exploring the mysteries of &lt;strong&gt;astrophysics&lt;/strong&gt; to diving into the logic of &lt;strong&gt;mathematics&lt;/strong&gt; and &lt;strong&gt;robotics&lt;/strong&gt;, I’m captivated by how the universe works and how we can shape it through innovation.&lt;/p&gt;
&lt;p&gt;As a developer, I enjoy &lt;strong&gt;programming&lt;/strong&gt; and building applications. Currently, I’m developing a project that combines &lt;strong&gt;Flask&lt;/strong&gt; for backend development with &lt;strong&gt;React&lt;/strong&gt; on the frontend, bridging technology and user experience seamlessly.&lt;/p&gt;</description>
      <content>&lt;p&gt;&lt;em&gt;Hi, I&amp;rsquo;m Swayam&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Welcome to my little corner of the internet! I’m a passionate learner and creator with a love for all things science, technology, and creativity. From exploring the mysteries of &lt;strong&gt;astrophysics&lt;/strong&gt; to diving into the logic of &lt;strong&gt;mathematics&lt;/strong&gt; and &lt;strong&gt;robotics&lt;/strong&gt;, I’m captivated by how the universe works and how we can shape it through innovation.&lt;/p&gt;
&lt;p&gt;As a developer, I enjoy &lt;strong&gt;programming&lt;/strong&gt; and building applications. Currently, I’m developing a project that combines &lt;strong&gt;Flask&lt;/strong&gt; for backend development with &lt;strong&gt;React&lt;/strong&gt; on the frontend, bridging technology and user experience seamlessly.&lt;/p&gt;
&lt;p&gt;Outside of coding, I’m an avid &lt;strong&gt;reader&lt;/strong&gt;, a fan of &lt;strong&gt;anime&lt;/strong&gt;, and a movie enthusiast. I also enjoy music and the art of storytelling, finding inspiration in every form of creativity.&lt;/p&gt;
&lt;p&gt;Curiosity fuels me, and I’m always looking to expand my knowledge, whether it’s through books, new projects, or exploring the vast realms of science and technology.&lt;/p&gt;
&lt;p&gt;Let’s connect and explore the infinite possibilities together!&lt;/p&gt;
&lt;hr&gt;
</content>
    </item>
    
  </channel>
</rss>
