<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jyoti Prakash Sethy</title>
    <description>The latest articles on DEV Community by Jyoti Prakash Sethy (@jyoti_prakash_25).</description>
    <link>https://dev.to/jyoti_prakash_25</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F802418%2F096a63fe-ca52-463a-aac8-96661b6d2d53.jpg</url>
      <title>DEV Community: Jyoti Prakash Sethy</title>
      <link>https://dev.to/jyoti_prakash_25</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jyoti_prakash_25"/>
    <language>en</language>
    <item>
      <title>🧊 Chillingly Efficient: A Deep Dive into Merge Sort 🔎</title>
      <dc:creator>Jyoti Prakash Sethy</dc:creator>
      <pubDate>Fri, 03 Mar 2023 18:14:51 +0000</pubDate>
      <link>https://dev.to/jyoti_prakash_25/chillingly-efficient-a-deep-dive-into-merge-sort-am5</link>
      <guid>https://dev.to/jyoti_prakash_25/chillingly-efficient-a-deep-dive-into-merge-sort-am5</guid>
      <description>&lt;p&gt;👋 Hey there! Are you tired of sorting through piles of data? 🤔 Merge Sort might just be the solution you're looking for! 🚀 In this post, we'll explore the ins and outs of this popular sorting algorithm 🤓 So buckle up and get ready to level up your sorting game! 🙌&lt;/p&gt;

&lt;p&gt;When it comes to sorting, there are many algorithms out there. But one stands out for its efficiency and elegance: Merge Sort. 🤩&lt;/p&gt;

&lt;p&gt;Merge Sort is a divide-and-conquer algorithm that works by recursively splitting the input array in half, sorting each half, and then merging the two halves back together. It is a very efficient algorithm with a time complexity of O(n log n) and a space complexity of O(n). 🙌&lt;/p&gt;

&lt;p&gt;🤔 But how does Merge Sort work, you ask?&lt;/p&gt;

&lt;p&gt;Well, it all starts with dividing the input array in half until each half contains only one element. At that point, we consider each half to be sorted. We then merge the two sorted halves back together by comparing the first element of each half and adding the smaller element to a new array. We repeat this process until all elements have been added to the new array in sorted order. 🤓&lt;/p&gt;

&lt;p&gt;The merge operation is where the algorithm gets its name. It works by taking two sorted arrays and merging them into a single sorted array. To merge two sorted arrays, we start by comparing the first element of each array. The smaller of the two elements is added to the new array, and the comparison continues with the next element in the array that contained the smaller element. This process continues until one of the arrays is exhausted. At this point, the remaining elements in the other array are added to the new array. 🧐&lt;/p&gt;

&lt;p&gt;🕰️ The time complexity of Merge Sort is O(n log n). This is because the algorithm recursively divides the input array into two halves until each half contains only one element. Sorting a single element array takes constant time. The merge operation that combines two sorted arrays takes linear time proportional to the sum of the sizes of the two arrays being merged. Since the input array is divided into halves log n times and each merge operation takes linear time, the total time complexity of Merge Sort is O(n log n). 🚀&lt;/p&gt;

&lt;p&gt;💾 The space complexity of Merge Sort is O(n). This is because the algorithm creates temporary arrays to hold the two halves of the input array and the merged array during the merge operation. The size of the temporary arrays is proportional to the size of the input array. The algorithm uses a total of O(n) space during the entire sorting process. &lt;/p&gt;

&lt;p&gt;let's take a closer look at the Merge Sort algorithm and how it works.&lt;/p&gt;

&lt;p&gt;Merge Sort is a divide-and-conquer algorithm, meaning that it breaks down a problem into smaller sub-problems, solves each sub-problem independently, and then combines the solutions to form the solution to the original problem. Specifically, Merge Sort works by recursively dividing an input array into two halves, sorting each half separately using Merge Sort, and then merging the two sorted halves back together to form a fully sorted array.&lt;/p&gt;

&lt;p&gt;To illustrate how Merge Sort works, let's consider the following example input array:&lt;br&gt;
&lt;code&gt;[38, 27, 43, 3, 9, 82, 10]&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
We can begin by dividing the input array in half to obtain two sub-arrays:&lt;br&gt;
&lt;code&gt;[38, 27, 43, 3] [9, 82, 10]&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
We can then recursively apply the same process to each sub-array, continuing to divide the sub-arrays in half until each sub-array contains only one element:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[38, 27] [43, 3] [9, 82] [10]&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;At this point, each sub-array is already sorted (since each sub-array contains only one element), so we can begin merging the sub-arrays back together. We start by merging the two leftmost sub-arrays &lt;code&gt;[38, 27]&lt;/code&gt; and &lt;code&gt;[43, 3]&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[38, 27] [43, 3] -&amp;gt; [27, 38, 3, 43]&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
We can see that the two sub-arrays have been merged into a single sorted sub-array [27, 38, 3, 43]. We then merge the next two sub-arrays &lt;code&gt;[9, 82]&lt;/code&gt; and &lt;code&gt;[10]&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[9, 82] [10] -&amp;gt; [9, 10, 82]&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Again, we have merged the two sub-arrays into a single sorted sub-array &lt;code&gt;[9, 10, 82]&lt;/code&gt;. Finally, we merge the two sorted sub-arrays &lt;code&gt;[27, 38, 3, 43]&lt;/code&gt; and &lt;code&gt;[9, 10, 82]&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[27, 38, 3, 43] [9, 10, 82] -&amp;gt; [3, 9, 10, 27, 38, 43, 82]&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And we have now obtained a fully sorted array &lt;code&gt;[3, 9, 10, 27, 38, 43, 82]&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Srj9Ogdu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sltjiyb6omwe402d9bww.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Srj9Ogdu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sltjiyb6omwe402d9bww.png" alt="Merge Sort" width="626" height="515"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, let's take a look at a C++ implementation of the Merge Sort algorithm:&lt;/p&gt;

&lt;blockquote&gt;

&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;

void merge(int arr[], int left, int mid, int right) {
    int i, j, k;
    int n1 = mid - left + 1;
    int n2 = right - mid;
    int L[n1], R[n2];
    for (i = 0; i &amp;lt; n1; i++) {
        L[i] = arr[left + i];
    }
    for (j = 0; j &amp;lt; n2; j++) {
        R[j] = arr[mid + 1 + j];
    }
    i = 0;
    j = 0;
    k = left;
    while (i &amp;lt; n1 &amp;amp;&amp;amp; j &amp;lt; n2) {
        if (L[i] &amp;lt;= R[j]) {
            arr[k] = L[i];
            i++;
        } else {
            arr[k] = R[j];
            j++;
        }
        k++;
    }
    while (i &amp;lt; n1) {
        arr[k] = L[i];
        i++;
        k++;
    }
    while (j &amp;lt; n2) {
        arr[k] = R[j];
        j++;
        k++;
    }
}

void mergeSort(int arr[], int left, int right) {
    if (left &amp;lt; right) {
        int mid = left + (right - left) / 2;
        mergeSort(arr, left, mid);
        mergeSort(arr, mid + 1, right);
        merge(arr, left, mid, right);
    }
}

int main() {
    int arr[] = {38, 27, 43, 3, 9, 82, 10};
    int n = sizeof(arr) / sizeof(arr[0]);
    mergeSort(arr, 0, n - 1);
    for (int i = 0; i &amp;lt; n; i++) {
        cout &amp;lt;&amp;lt; arr[i] &amp;lt;&amp;lt; " ";
    }
    cout &amp;lt;&amp;lt; endl;
    return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;merge&lt;/code&gt; function takes in an input array &lt;code&gt;arr&lt;/code&gt;, and the leftmost and rightmost indices of two sub-arrays, and merges the sub-arrays back together in sorted order using the algorithm we described earlier. The &lt;code&gt;mergeSort&lt;/code&gt; function takes in an input array arr, the leftmost and rightmost indices of the sub-array to be sorted, and recursively applies the Merge Sort algorithm to the sub-array until it is fully sorted. Finally, the &lt;code&gt;main&lt;/code&gt; function defines an input array arr, sorts it using &lt;code&gt;mergeSort&lt;/code&gt;, and prints the sorted array.&lt;/p&gt;

&lt;p&gt;🤖 Merge Sort is widely used in many applications where sorting large datasets or maintaining the relative order of equal elements is important. It is especially useful when sorting linked lists, as it doesn't require random access to elements. Merge Sort is also a stable algorithm, which means that it preserves the relative order of equal elements in the input array. This property is useful in many applications, such as sorting data with multiple fields where one field is used as the primary sort key and another field is used as a secondary sort key. 🤓&lt;/p&gt;

&lt;p&gt;In conclusion, Merge Sort is a very efficient and elegant sorting algorithm that works by dividing the input array into two halves, sorting each half recursively, and then merging the sorted halves back together. It has a time complexity of O(n log n) and a space complexity of O(n). Merge Sort is widely used in many applications where sorting large datasets or maintaining the relative order of equal elements is important. Give it a try next time you need to sort some data! 😎&lt;/p&gt;

</description>
      <category>mergesort</category>
      <category>sorting</category>
      <category>algorithms</category>
      <category>programming</category>
    </item>
    <item>
      <title>🔍🆚🔍 Insertion Sort: The Perfect Blend of Simplicity and Efficiency 🔍🆚🔍</title>
      <dc:creator>Jyoti Prakash Sethy</dc:creator>
      <pubDate>Fri, 24 Feb 2023 21:18:38 +0000</pubDate>
      <link>https://dev.to/jyoti_prakash_25/insertion-sort-the-perfect-blend-of-simplicity-and-efficiency-57c2</link>
      <guid>https://dev.to/jyoti_prakash_25/insertion-sort-the-perfect-blend-of-simplicity-and-efficiency-57c2</guid>
      <description>&lt;p&gt;Welcome back, data enthusiasts! 💻📊 In our first post, we explored the world of Bubble sort, Selection sort, and Quick sort, but the sorting journey doesn't end there. In this post, we'll dive even deeper into the world of data organisation and learn about Insertion sort, Merge sort, and Heap sort. Get ready to master these powerful techniques and take your data sorting skills to the next level! 🔜 &lt;/p&gt;

&lt;h2&gt;
  
  
  Insertion Sort: From the Short &amp;amp; Sweet to the King of Efficiency 🚀
&lt;/h2&gt;

&lt;p&gt;Hi, it's Kunal and Priyansh, the dynamic duo behind this series on sorting algorithms. In our first post, we talked about the bubbly Bubble Sort and the selective Selection Sort. And today, we're going to introduce you to one of the simplest, yet most efficient, sorting algorithms: the Insertion Sort 💡&lt;/p&gt;

&lt;p&gt;Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. But when it comes to small or partially sorted arrays, it's the king of the game 🔝&lt;/p&gt;

&lt;p&gt;To understand how it works, let's imagine that we have a deck of cards. We want to sort the deck in ascending order, so we start by picking up the first card, which becomes our sorted portion of the deck. Then, we pick up the next card, compare it with the cards already in our sorted portion, and insert it in its correct position. We repeat this process until we have sorted all the cards 🃏&lt;/p&gt;

&lt;p&gt;This is exactly how the insertion sort algorithm works. The algorithm divides the input into two parts: the sorted portion and the unsorted portion. It iterates through the unsorted portion, picks an element and inserts it in its correct position in the sorted portion. It does this by swapping elements until it finds the right spot for the picked element.&lt;/p&gt;

&lt;h3&gt;
  
  
  Time Complexity:
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;The time complexity of Insertion Sort depends on the size of the input array. In the best-case scenario, the array is already sorted and it takes &lt;code&gt;O(n)&lt;/code&gt; time, where n is the number of elements in the array. But in the worst-case scenario, the array is sorted in descending order, and it takes &lt;code&gt;O(n^2)&lt;/code&gt; time.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Space Complexity:
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;The space complexity of Insertion Sort is &lt;code&gt;O(1)&lt;/code&gt;, which means it requires a constant amount of memory to sort the elements. It performs the sorting in-place, meaning it sorts the elements within the same array and doesn't require any additional memory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrjoxw4wxsfxk6yc1yyp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrjoxw4wxsfxk6yc1yyp.png" alt="Insertion Sort" width="562" height="569"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Use Cases:
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Insertion sort is a simple sorting algorithm that is easy to understand and implement. It's an efficient sorting algorithm for small arrays and partially sorted arrays. It's also used as a subroutine in other sorting algorithms such as Shell Sort.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here's an example of sorting an array of numbers in ascending order using the Insertion Sort algorithm in C++:&lt;/p&gt;

&lt;blockquote&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;
void insertionSort(int arr[], int n) {
   int i, key, j;
   for (i = 1; i &amp;lt; n; i++) {
      key = arr[i];
      j = i - 1;
      while (j &amp;gt;= 0 &amp;amp;&amp;amp; arr[j] &amp;gt; key) {
         arr[j + 1] = arr[j];
         j = j - 1;
      }
      arr[j + 1] = key;
   }
}
void printArray(int arr[], int n) {
   int i;
   for (i = 0; i &amp;lt; n; i++)
      cout &amp;lt;&amp;lt; arr[i] &amp;lt;&amp;lt; " ";
   cout &amp;lt;&amp;lt; endl;
}
int main() {
   int arr[] = { 12, 11, 13, 5, 6 };
   int n = sizeof(arr) / sizeof(arr[0]);
   cout &amp;lt;&amp;lt; "Array before sorting: \n";
   printArray(arr, n);
   insertionSort(arr, n);
   cout &amp;lt;&amp;lt; "Array after sorting: \n";
   printArray(arr, n);
   return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;p&gt;The code shown above is an implementation of Insertion Sort in C++. This sorting algorithm is a simple sorting algorithm that works by building the final sorted array one item at a time. It is much less efficient on large lists than more advanced algorithms such as &lt;code&gt;QuickSort&lt;/code&gt;, &lt;code&gt;MergeSort&lt;/code&gt;, or &lt;code&gt;HeapSort&lt;/code&gt;, but it has the advantage of being very easy to understand, simple to implement, and highly efficient for small lists or lists that are already partially sorted.&lt;/p&gt;

&lt;p&gt;In the code, we first initialise an array of integers and its size. Then, we define the &lt;code&gt;insertionSort&lt;/code&gt; function which takes the array and its size as arguments.&lt;/p&gt;

&lt;p&gt;The sorting process starts with the second element of the array (index 1) and compares it with the first element (index 0). If the second element is smaller than the first, we swap them. This process continues for each subsequent element in the array until all elements are sorted.&lt;/p&gt;

&lt;p&gt;The outer loop of the function iterates over the elements of the array from the second element to the last. The inner loop, starting from the current outer loop index, compares each element with the previous one and if it is smaller, it swaps them. This inner loop continues until the element is in its correct position.&lt;/p&gt;

&lt;p&gt;At the end, the sorted array is displayed using a for loop.&lt;/p&gt;

&lt;p&gt;It's important to note that Insertion Sort has a time complexity of O(n^2) in the worst case scenario. However, its best case time complexity is O(n) when the list is already sorted or partially sorted. The space complexity of Insertion Sort is O(1), meaning that it requires a constant amount of memory to perform the sorting.&lt;/p&gt;

&lt;p&gt;This sorting algorithm is useful for small lists or when the list is already partially sorted. It can also be used as a subroutine in more advanced algorithms to sort smaller sublists.&lt;/p&gt;

&lt;p&gt;In conclusion, insertion sort is a simple and efficient sorting algorithm that works well for small arrays or partially sorted arrays. It has a space complexity of O(1), making it an in-place sorting algorithm. The time complexity of insertion sort ranges from O(n) for the best-case scenario to O(n^2) for the worst-case scenario, making it suitable for arrays with a small number of elements. Although insertion sort may not be as fast as some other sorting algorithms, it is easy to understand and implement, making it a great starting point for beginner programmers or a useful tool to keep in your algorithmic toolkit. Whether you're just starting out or a seasoned veteran, mastering insertion sort is a valuable step towards becoming a more effective problem-solver.&lt;/p&gt;

</description>
      <category>vibecoding</category>
      <category>discuss</category>
      <category>productivity</category>
      <category>ai</category>
    </item>
    <item>
      <title>Sorting the Data: A Whirl Wind Tour of Algorithms 🔍💻🔼🔽🕰️</title>
      <dc:creator>Jyoti Prakash Sethy</dc:creator>
      <pubDate>Mon, 06 Feb 2023 14:25:16 +0000</pubDate>
      <link>https://dev.to/jyoti_prakash_25/sorting-the-data-a-whirl-wind-tour-of-algorithms-5ege</link>
      <guid>https://dev.to/jyoti_prakash_25/sorting-the-data-a-whirl-wind-tour-of-algorithms-5ege</guid>
      <description>&lt;p&gt;Once upon a time, there was a young programmer named Kunal 💻 who was tasked with organizing a large amount of data for a client 💼. He had heard that sorting was an essential aspect in many computer science applications 💻🔍, but he wasn't sure where to start 🤔. He reached out to his mentor, Priyansh 🧑‍💼, who was a seasoned programmer and an expert in sorting algorithms 🧠.&lt;/p&gt;

&lt;p&gt;Priyansh 🧑‍💼 took Kunal 💻 under his wing and began to teach him about the different sorting techniques available 📚. He explained that sorting algorithms arrange a set of elements in a particular order, either ascending 🔼 or descending 🔽, based on certain criteria 📊. There are various sorting algorithms available, each with its own advantages and disadvantages in terms of time 🕰️ and space complexity 🚀, stability 🤞, and ease of implementation 💻.&lt;/p&gt;

&lt;p&gt;Together, Priyansh 🧑‍💼 and Kunal 💻 went through each sorting algorithm, including Bubble sort 🧼, Insertion sort 💼, Selection sort 🔍, Quick sort 💨, Merge sort 🔄, Heap sort 🧊, Shell sort 🐚, Counting sort 🔢, Radix sort 💡, and Bucket sort 🧺. They discussed the time and space complexity of each algorithm and when it was appropriate to use each one 📊. They also provided examples and code samples in C++ 💻 to help illustrate the concepts 💡.&lt;/p&gt;

&lt;p&gt;By the end of their lessons, Kunal 💻 had a solid understanding of the different sorting techniques and was confident in his ability to implement them in his work 💪. He was grateful to Priyansh 🧑‍💼 for his guidance and expertise 🙏, and he went on to use his newfound knowledge to solve many complex data-related problems for his clients 💼.&lt;/p&gt;

&lt;p&gt;Just like Kunal 💻, this blog post is here to help you understand the different sorting techniques and their implementation 💡. Whether you are a beginner 🔜 or an experienced programmer 💻💼, join us as we delve into the world of sorting algorithms 🔍.&lt;/p&gt;

&lt;h1&gt;
  
  
  Bubble Sort: The OG of Sorting Algorithms 🧼🔍
&lt;/h1&gt;

&lt;p&gt;Welcome back data enthusiasts, we're diving into the first sorting algorithm on our list: Bubble sort 💡. As the name suggests, this algorithm is like a group of bubbles rising to the top 🧼. It's a simple and straightforward technique that's great for small data sets, but not so much for large ones 💼💻.&lt;/p&gt;

&lt;p&gt;Bubble sort works by repeatedly swapping adjacent elements if they are in the wrong order 🔀. This continues until the list is sorted in the desired order 🔢. The idea is simple, but the execution can be time-consuming, making it less efficient for larger data sets 🕰️.&lt;/p&gt;

&lt;h4&gt;
  
  
  Time Complexity: O(n^2) 🕰️
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Space Complexity: O(1) 💾
&lt;/h4&gt;

&lt;p&gt;Bubble sort is best used for educational purposes, as it's a great way to understand the basic principles of sorting algorithms 💡. It's also useful in certain niche use cases, such as when the data set is already partially sorted or nearly sorted 💼.&lt;/p&gt;

&lt;p&gt;Now, let's see how bubble sort works with a simple example:&lt;/p&gt;

&lt;blockquote&gt;

&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;

void bubbleSort(int arr[], int n)
{
    int i, j;
    for (i = 0; i &amp;lt; n - 1; i++)
    {
        for (j = 0; j &amp;lt; n - i - 1; j++)
        {
            if (arr[j] &amp;gt; arr[j + 1])
            {
                int temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
}

int main()
{
    int arr[] = {64, 34, 25, 12, 22, 11, 90};
    int n = sizeof(arr) / sizeof(arr[0]);
    bubbleSort(arr, n);
    cout &amp;lt;&amp;lt; "Sorted array is: \n";
    for (int i = 0; i &amp;lt; n; i++)
        cout &amp;lt;&amp;lt; arr[i] &amp;lt;&amp;lt; " ";
    return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's Get Bubbly with Bubble Sort 🧼💃&lt;/p&gt;

&lt;p&gt;We've got a bubbly bunch of code here, folks! 🧼 This is the Bubble Sort algorithm in all its glory. And just like a group of bubbles, the goal of this algorithm is to sort the elements in an array so they float up to the top in the desired order 🔢.&lt;/p&gt;

&lt;p&gt;The code starts by defining a function &lt;code&gt;bubbleSort&lt;/code&gt; that takes in an integer array arr and its size n. Then, we have two for loops that are going to do the heavy lifting. The first loop starts at 0 and runs until n-1 iterations, and the second loop starts at 0 and runs until n-i-1 iterations.&lt;/p&gt;

&lt;p&gt;The inner loop goes through each element in the array and compares it to the next element. If the current element is greater than the next element, the algorithm swaps them using a temporary variable temp 🔀. This continues for each iteration of the inner loop, until the array is sorted in ascending order 🔼.&lt;/p&gt;

&lt;p&gt;Finally, we have the main function which creates an integer array arr with 7 elements and calculates its size n. The &lt;code&gt;bubbleSort&lt;/code&gt; function is then called, passing in arr and n as parameters. The sorted array is displayed using a for loop and &lt;code&gt;cout&lt;/code&gt; statement 💻.&lt;/p&gt;

&lt;p&gt;Now, let's imagine you have a bunch of random numbers and want to sort them in ascending order. You could use bubble sort and watch as the larger numbers rise to the top just like bubbles in a glass of champagne 🍾.&lt;/p&gt;

&lt;p&gt;And there you have it, a simple implementation of Bubble sort 💡. So next time you're working with small data sets, remember to call upon the OG of sorting algorithms 🧼.&lt;/p&gt;

&lt;h1&gt;
  
  
  Selection Sort: Choosing the Right One 🔍🏆
&lt;/h1&gt;

&lt;p&gt;Alright, data enthusiasts! We're moving on to the next sorting algorithm on our list: Selection sort 💡. As the name suggests, this algorithm involves selecting the right element to be in its correct position 🔍. It works by dividing the list into two parts: a sorted part and an unsorted part 💼. The algorithm then selects the minimum element from the unsorted part and adds it to the sorted part, repeating the process until the entire list is sorted 🔢.&lt;/p&gt;

&lt;h4&gt;
  
  
  Time Complexity: O(n^2) 🕰️
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Space Complexity: O(1) 💾
&lt;/h4&gt;

&lt;p&gt;Selection sort is a great choice when memory is limited and you can't afford to use extra memory 💼💻. It's also useful when the data set is small and you don't need an efficient algorithm 💡.&lt;/p&gt;

&lt;p&gt;Let's see how selection sort works with a simple example:&lt;/p&gt;

&lt;blockquote&gt;

&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;

void selectionSort(int arr[], int n) {
   int i, j, minIndex;
   for (i = 0; i &amp;lt; n-1; i++) {
      minIndex = i;
      for (j = i+1; j &amp;lt; n; j++) {
         if (arr[j] &amp;lt; arr[minIndex])
            minIndex = j;
      }
      int temp = arr[minIndex];
      arr[minIndex] = arr[i];
      arr[i] = temp;
   }
}

int main() {
   int arr[] = {64, 25, 12, 22, 11};
   int n = sizeof(arr)/sizeof(arr[0]);
   selectionSort(arr, n);
   cout &amp;lt;&amp;lt; "Sorted array is: \n";
   for (int i=0; i &amp;lt; n; i++)
      cout &amp;lt;&amp;lt; arr[i] &amp;lt;&amp;lt; " ";
   return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's dive into the code sample of Selection sort 💻💡.&lt;/p&gt;

&lt;p&gt;The first thing we do is to include the &lt;code&gt;iostream&lt;/code&gt; library and declare using namespace std; so we can use &lt;code&gt;cout&lt;/code&gt; and &lt;code&gt;endl&lt;/code&gt; in our code later on 🔌.&lt;/p&gt;

&lt;p&gt;Next up, we have the &lt;code&gt;selectionSort&lt;/code&gt; function which takes in two arguments: an integer array arr and an integer n which represents the size of the array 📊.&lt;/p&gt;

&lt;p&gt;In the function, we start by initializing three variables: i, j, and &lt;code&gt;minIndex&lt;/code&gt; 💻. i will be used to iterate through the entire list and j will be used to compare elements to find the minimum element in the unsorted part of the list 🔍. &lt;code&gt;minIndex&lt;/code&gt; keeps track of the index of the minimum element found in each iteration of the inner loop.&lt;/p&gt;

&lt;p&gt;The outer loop starts at i = 0 and goes until i is equal to n-1, which means we've gone through the entire list once 🔢. In each iteration, &lt;code&gt;minIndex&lt;/code&gt; is set to i, which represents the starting point for the inner loop 💻.&lt;/p&gt;

&lt;p&gt;The inner loop starts at j = i + 1 and goes until j is equal to n. In each iteration, it compares the current element arr[j] with the current minimum element &lt;code&gt;arr[minIndex]&lt;/code&gt; 🔍. If the current element is smaller than the current minimum, &lt;code&gt;minIndex&lt;/code&gt; is updated to the index of the current element 💻.&lt;/p&gt;

&lt;p&gt;Once the inner loop finishes, we use a simple swap operation to put the minimum element in its correct position by swapping it with the current element at arr[i] 🔄.&lt;/p&gt;

&lt;p&gt;Finally, the outer loop repeats until i is equal to n-1, at which point the list is fully sorted 🔢.&lt;/p&gt;

&lt;p&gt;In the main function, we declare an array arr with the values {64, 25, 12, 22, 11} and find the size of the array with n = sizeof(arr)/sizeof(arr[0]). We then call the &lt;code&gt;selectionSort&lt;/code&gt; function and pass in arr and n as arguments 💻.&lt;/p&gt;

&lt;p&gt;After the sorting is done, we use a for loop to print out the sorted array 🔢. And just like that, we have a fully sorted list thanks to Selection sort! 🎉&lt;/p&gt;

&lt;p&gt;So there you have it, a simple but powerful explanation of the code sample for Selection sort 💻💡. Who knew sorting could be this much fun? 😃  So the next time you need to choose the right element for its correct position, remember Selection sort 🔍.&lt;/p&gt;

&lt;p&gt;Next up on our sorting adventure is Quick sort! 🔜&lt;/p&gt;

&lt;h1&gt;
  
  
  Quick Sort: Sorting in a Flash 🔥💨
&lt;/h1&gt;

&lt;p&gt;Alright data enthusiasts, we're getting to one of the most popular sorting algorithms: Quick sort! 💥 It's a fast and efficient algorithm that works by dividing the list into smaller parts and then sorting them independently 💻. It's based on the divide and conquer approach, where the list is divided into two parts and then sorted recursively 💡.&lt;/p&gt;

&lt;p&gt;The Quick sort algorithm works by selecting a pivot element from the list. The pivot element is used to divide the list into two parts: the smaller elements to the left of the pivot and the larger elements to the right of the pivot. Then, we sort the two parts independently using the Quick sort algorithm. The process is repeated until all elements in the list are sorted in ascending order 🔼.&lt;/p&gt;

&lt;h4&gt;
  
  
  Time Complexity : O(nlogn) 🕰️
&lt;/h4&gt;

&lt;p&gt;Quick sort has a time complexity of O(nlogn) 🕰️, which is considered to be one of the best time complexities for sorting algorithms. The time complexity of Quick sort is dependent on the pivot element that is selected. If the pivot element is always selected to be the median or close to the median, then the time complexity will be close to O(nlogn). But, if the pivot element is always selected to be the smallest or largest element, then the time complexity will be closer to O(n^2).&lt;/p&gt;

&lt;h4&gt;
  
  
  Space Complexity: O(logn) 💾
&lt;/h4&gt;

&lt;p&gt;The space complexity of Quick sort is dependent on the number of recursive calls that are made. Each recursive call requires O(logn) space, so the total space complexity is O(logn).&lt;/p&gt;

&lt;p&gt;Quick sort is a great choice when you have a large data set and you want to sort it efficiently 💻🔍. It's also great when you want to sort the data in-place and minimize the use of memory 💼💻.&lt;/p&gt;

&lt;p&gt;Let's see how Quick sort works with a simple example:&lt;/p&gt;

&lt;blockquote&gt;

&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;

int partition(int arr[], int low, int high) {
   int pivot = arr[high];
   int i = (low - 1);

   for (int j = low; j &amp;lt;= high- 1; j++) {
      if (arr[j] &amp;lt;= pivot) {
         i++;
         int temp = arr[i];
         arr[i] = arr[j];
         arr[j] = temp;
      }
   }
   int temp = arr[i + 1];
   arr[i + 1] = arr[high];
   arr[high] = temp;
   return (i + 1);
}

void quickSort(int arr[], int low, int high) {
   if (low &amp;lt; high) {
      int pi = partition(arr, low, high);
      quickSort(arr, low, pi - 1);
      quickSort(arr, pi + 1, high);
   }
}

int main() {
   int arr[] = {64, 25, 12, 22, 11};
   int n = sizeof(arr)/sizeof(arr[0]);
   quickSort(arr, 0, n-1);
   cout &amp;lt;&amp;lt; "Sorted array is: \n";
   for (int i=0; i &amp;lt; n; i++)
      cout &amp;lt;&amp;lt; arr[i] &amp;lt;&amp;lt; " ";
   return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Okay! Let's dive into the details of the code sample.&lt;/p&gt;

&lt;p&gt;First, we have defined the &lt;code&gt;partition&lt;/code&gt; function. This function takes the array, the start index, and the end index as input. Its purpose is to divide the array into two parts, where elements smaller than the pivot element are to the left of the pivot, and elements greater than the pivot are to the right of it. This is done by selecting a pivot element and swapping it with elements until it reaches its correct position in the array.&lt;/p&gt;

&lt;p&gt;Next, we have the &lt;code&gt;quickSort&lt;/code&gt; function, which is the actual implementation of the Quick sort algorithm. It takes the array, start and end indices as input and uses recursion to sort the array. The function first checks if the start index is less than the end index, which means there is at least one element to sort. If this condition is met, the partition function is called, and the pivot index is returned. This pivot index is used to divide the array into two parts: the left part and the right part. The &lt;code&gt;quickSort&lt;/code&gt; function is then called recursively on both the left and right parts, which eventually sorts the entire array.&lt;/p&gt;

&lt;p&gt;The time complexity of Quick sort is O(n log n) on average, and its space complexity is O(log n). Quick sort is an efficient sorting algorithm and is widely used in many applications.&lt;/p&gt;

&lt;p&gt;And that's it! With this, you now know how Quick sort works, its time and space complexities, and its use cases. Try running this code on your own and see how Quick sort works like magic 🧙‍♂️!&lt;/p&gt;

&lt;p&gt;And there you have it folks! The first part of our sorting algorithm journey 🚀. We've covered three popular sorting techniques: Bubble sort 💥, Selection sort 🔍, and Quick sort 💨.&lt;/p&gt;

&lt;p&gt;Each technique has its own unique strengths and weaknesses, and it's important to understand when to use each one. Whether you're sorting a small list of numbers or a large database, there's a sorting algorithm out there that's right for you 💻💡.&lt;/p&gt;

&lt;p&gt;So, what's next in our journey? Well, stay tuned for the next part of our sorting algorithm series, where we'll cover even more techniques! 🔜 We'll take a closer look at Merge sort 🔄, Heap sort 🌳, Shell sort 🐚, Counting sort 💰, Radix sort 🔢, and Bucket sort 🛢️.&lt;/p&gt;

&lt;p&gt;As always, if you have any questions or comments, feel free to reach out 💬. And remember, happy sorting! 🎉&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>accountabilibuddies</category>
      <category>career</category>
      <category>discuss</category>
    </item>
    <item>
      <title>🚀 "Three.js: Unleashing the Power of 3D Animations on the Web 🌟"</title>
      <dc:creator>Jyoti Prakash Sethy</dc:creator>
      <pubDate>Sun, 15 Jan 2023 13:36:51 +0000</pubDate>
      <link>https://dev.to/jyoti_prakash_25/threejs-unleashing-the-power-of-3d-animations-on-the-web--34bd</link>
      <guid>https://dev.to/jyoti_prakash_25/threejs-unleashing-the-power-of-3d-animations-on-the-web--34bd</guid>
      <description>&lt;p&gt;Once upon a time, there was a web developer named Jane. Jane was a proficient developer, but her websites were as exciting as watching paint dry. She longed to create something that would leave visitors in awe, but she didn't know how.&lt;/p&gt;

&lt;p&gt;One fateful day, while browsing the web, Jane stumbled upon a magical library called Three.js. She had heard of it before but never really paid it much attention. But this time, something caught her eye. "With this library", she thought, "I can create 3D animations and visualizations on my website that will make it look like a Pixar movie 🎬".&lt;/p&gt;

&lt;p&gt;Without hesitation, Jane decided to give Three.js a try. She went to the website and started reading the documentation. She quickly realized that the library was very user-friendly and had a wide range of pre-built objects that she could use to create her scenes. These objects include &lt;code&gt;THREE.Scene&lt;/code&gt;, &lt;code&gt;THREE.Camera&lt;/code&gt;, &lt;code&gt;THREE.Light&lt;/code&gt;, and &lt;code&gt;THREE.Geometry&lt;/code&gt;. She decided to create a simple scene with a cube, a camera, and a light source.&lt;/p&gt;

&lt;p&gt;Excited by the possibilities, Jane started experimenting with the library. She imported a 3D model of a unicorn 🦄 and created some animations using &lt;code&gt;THREE.AnimationMixer&lt;/code&gt; and &lt;code&gt;THREE.AnimationClip&lt;/code&gt;. She also added some camera controls using &lt;code&gt;THREE.OrbitControls&lt;/code&gt;, which allowed visitors to navigate and zoom in and out of the scene. Additionally, She also found a lot of tutorials and examples online that helped her understand the library even better.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxy80iu3yzq28xn1gr5t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxy80iu3yzq28xn1gr5t.png" alt="Meme" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As she delved deeper into the world of Three.js, Jane also wanted to add some interactive elements to her website, so she added some events to her objects. For example, she added an event listener to the cube so that when visitors clicked on it, it would rotate 🤩. She also added an event listener to the unicorn so that when visitors moved their mouse over it, it would change color 🌈.&lt;/p&gt;

&lt;p&gt;Jane was very impressed by the flexibility of the library and its ability to handle complex geometries and large data sets with ease. She also found that the library supports multiple materials such as &lt;code&gt;THREE.MeshStandardMaterial&lt;/code&gt;, &lt;code&gt;THREE.ShaderMaterial&lt;/code&gt; and &lt;code&gt;THREE.SpriteMaterial&lt;/code&gt; which allowed her to create realistic and stunning 3D visuals.&lt;/p&gt;

&lt;p&gt;Finally, the day came when Jane's website was ready to be launched to the world. As she hit the "publish" button, she could hardly contain her excitement. And when she saw the reactions of her visitors, she knew all her hard work had paid off. Her website was a hit! Visitors were impressed by the animations, the visualizations, and the interactivity of the website.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fortizw3fm8alvjpgyobx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fortizw3fm8alvjpgyobx.png" alt="meme of a dog with the caption " width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
From that day on, Jane became the go-to person for creating websites that stood out from the crowd. She even wrote a book about her experience with Three.js and how it helped her become a better developer. She shared her knowledge and tips with other developers, helping them to create stunning websites too.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The end.&lt;/p&gt;

&lt;p&gt;Thanks to Three.js, Jane's websites were no longer boring and mundane, but rather visually stunning and nteractive. She also found that the library had a lot of advanced features like physics simulation, post-processing effects, and advanced texturing, which made it even more versatile.&lt;/p&gt;

&lt;p&gt;With the help of Three.js, Jane was able to create interactive and visually appealing websites that left visitors in awe. She was able to take her web development skills to the next level and create something truly special. So, if you're a web developer looking to add some extra oomph to your website, give Three.js a try and let the magic begin! 🌟🚀&lt;/p&gt;

&lt;p&gt;In the end, Jane's story serves as a reminder that with the right tools, anyone can create something truly special and that Three.js is definitely one of those tools. It's an excellent library for web developers of all skill levels looking to create interactive and visually appealing websites. With its easy-to-use API and a wealth of resources and tutorials available online, developers can quickly learn how to use the library and create stunning 3D animations and visualizations that will take their websites to the next level. So, don't be like Jane before she discovered Three.js, be like Jane after she discovered it and unleash the power of 3D animations on your website today!&lt;/p&gt;

</description>
      <category>java</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>🚀 Rev Up Your Design Game with Tailwind CSS - The 🔥 Hot &amp; Flexible Framework 🛠️</title>
      <dc:creator>Jyoti Prakash Sethy</dc:creator>
      <pubDate>Tue, 10 Jan 2023 17:52:11 +0000</pubDate>
      <link>https://dev.to/jyoti_prakash_25/rev-up-your-design-game-with-tailwind-css-the-hot-flexible-framework-48fa</link>
      <guid>https://dev.to/jyoti_prakash_25/rev-up-your-design-game-with-tailwind-css-the-hot-flexible-framework-48fa</guid>
      <description>&lt;p&gt;Are you tired of spending hours trying to write CSS code, just to make your website look like it's straight out of the 90s? Look no further, because today we're going to talk about the saving grace of the web development world: &lt;strong&gt;Tailwind CSS&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But before we dive into the nitty-gritty of this game-changing CSS framework, let's first set the scene.Imagine you're at a party, and you're trying to impress that cute person you've been crushing on. You put on your best outfit, you've got your hair just right, and you're feeling good. But then you show up to the party and realize that everyone else is wearing the same thing. It's like you all decided to twin without even planning it. You feel like a total fashion faux pas.&lt;/p&gt;

&lt;p&gt;Now imagine the same thing happening when building a website. You spend hours trying to make your site stand out, you add custom CSS and javascript and yet, it just looks like every other site out there. With Tailwind, you'll be the life of the party (or the internet, rather) by creating custom, unique designs with minimal effort.&lt;/p&gt;

&lt;p&gt;But what exactly is Tailwind? It's a utility-first CSS framework that provides a set of pre-defined CSS classes that you can use to quickly design your website. Instead of writing custom CSS, you simply apply the appropriate classes to your HTML elements, and voila! You've got yourself a beautifully designed website in no time. It's like magic.🎩&lt;/p&gt;

&lt;p&gt;Let me give you an example, you want to create a fancy call-to-action button, the traditional way would be something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;style&amp;gt;
  .cta-button {
    background-color: blue;
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    font-weight: bold;
  }
&amp;lt;/style&amp;gt;
&amp;lt;button class="cta-button"&amp;gt;Click Me&amp;lt;/button&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that's a lot of code for a simple button, with Tailwind you could do it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button class="bg-blue-500 text-white py-2 px-4 rounded-lg font-medium"&amp;gt;Click me!&amp;lt;/button&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see it's more concise, easy to read and you don't have to worry about naming conventions or making sure the button works with the rest of your design.&lt;/p&gt;

&lt;p&gt;One of the best things about Tailwind is that it's highly customizable. You can easily adjust the colors, spacing, typography, and more to match your design requirements. And if you're not happy with the default settings, you can even create your own custom classes and extend the framework to suit your needs. It's like being able to customize your own superhero suit.🦸‍♂️&lt;/p&gt;

&lt;p&gt;And if you're worried about the size of your CSS files, don't worry! Tailwind includes a built-in purging process that removes any unused classes, resulting in much smaller CSS files. It's like decluttering your closet, but for your CSS.🧹&lt;/p&gt;

&lt;p&gt;But the real kicker is that it's super easy to use and you'll save hours of design and development time. So why not give it a try? I promise you'll love it. It's like trying a new type of ice cream, you might not know you like it until you try it.🍦&lt;/p&gt;

&lt;p&gt;One more thing, it also supports some of the popular frameworks and libraries such as React, Angular, Vue, and Svelte. So, you can use it with your preferred tech stack. It's like being able to wear your favorite pair of shoes with any outfit. It's versatile and can adapt to your needs.&lt;/p&gt;

&lt;p&gt;Another great thing about Tailwind is that it's built with accessibility in mind, it provides a lot of classes for creating accessible and semantic HTML elements, which can be a real time saver. For example, you can use the &lt;code&gt;sr-only&lt;/code&gt; class to visually hide an element but still make it accessible for screen readers, or the &lt;code&gt;focus:outline-none&lt;/code&gt; class to remove the default browser outline when an element is focused, it makes sure that your website is accessible for everyone.&lt;/p&gt;

&lt;p&gt;Overall, Tailwind is a must-have tool for any web developer looking to streamline their workflow and create unique, high-quality designs. It's like having a personal designer and coder that lives in your computer, and it's always on call and ready to work.💻&lt;/p&gt;

&lt;p&gt;So, instead of spending hours trying to figure out how to create a specific design or layout, you can focus on what really matters: building great features and user experiences.&lt;/p&gt;

&lt;p&gt;In conclusion, Tailwind is an amazing tool that can help you create beautiful and functional websites quickly and easily. So why waste time writing custom CSS when you can use Tailwind and create a website that will make your users say "Wow, this website is on fleek!" 🔥🚀&lt;/p&gt;

&lt;p&gt;P.S. Don't forget to invite me to your next website launch party. I love cake.🎂&lt;/p&gt;

</description>
      <category>vibecoding</category>
    </item>
    <item>
      <title>🛡️ Virtual Protection 101🔒: Managing Users, Groups, and Firewalls🔥 in Ubuntu 💻</title>
      <dc:creator>Jyoti Prakash Sethy</dc:creator>
      <pubDate>Wed, 28 Dec 2022 20:25:55 +0000</pubDate>
      <link>https://dev.to/jyoti_prakash_25/virtual-protection-101-managing-users-groups-and-firewalls-in-ubuntu-3g2i</link>
      <guid>https://dev.to/jyoti_prakash_25/virtual-protection-101-managing-users-groups-and-firewalls-in-ubuntu-3g2i</guid>
      <description>&lt;p&gt;Welcome to the zany world of Ubuntu system administration! 👋 Are you ready to learn how to manage users, groups, and secure your system like a boss? 😎 Great, because we're about to embark on a wild journey (well, technically it's more like a leisurely stroll, but you get the idea).&lt;/p&gt;

&lt;h2&gt;
  
  
  Managing Users and Groups
&lt;/h2&gt;

&lt;p&gt;First up, let's talk about managing users 🧑 and groups. In Ubuntu, every user belongs to at least one group, and these groups are used to control access to resources on the system. For example, the &lt;code&gt;sudo&lt;/code&gt; group allows users to perform administrative tasks, like changing the wallpaper or deleting the entire operating system (just kidding, please don't do that, we need this article to be funny, not tragic 😥).&lt;/p&gt;

&lt;p&gt;To create a new user, we have to open the terminal and type &lt;code&gt;adduser&lt;/code&gt;  and replace  with the desired username for our new user. We'll be prompted to enter a password and other information for the user, such as their full name and contact information. Don't worry, this process is super easy, even for beginner sysadmins (or as we like to call them, "sysawesome-dventurers"). We can also use the &lt;code&gt;useradd&lt;/code&gt; command to create a new user, but &lt;code&gt;adduser&lt;/code&gt; is generally easier to use as it prompts us for all the necessary information. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adduser john

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would create a new user called john with the default settings. Just like that, we've created a new person! Or at least, a virtual person that exists on our system.&lt;/p&gt;

&lt;p&gt;To add a user to a group, use the &lt;code&gt;usermod&lt;/code&gt; command. For example, to add the user john to the &lt;code&gt;sudo&lt;/code&gt; group (because let's face it, who doesn't want to feel like a boss?), type&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;usermod -aG sudo john

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To view the groups a user belongs to,we can use the &lt;code&gt;groups&lt;/code&gt; command followed by the username. It's as simple as that! Just remember, with great power 💪 comes great responsibility (cue the Spider-Man meme, or the Power Rangers theme song, our choice). For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;groups john

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would display a list of all the groups that john belongs to. It's like a virtual resume for our virtual person!&lt;/p&gt;

&lt;p&gt;We can also create our own groups if we need to control access to specific resources. To create a new group,we can use the &lt;code&gt;groupadd&lt;/code&gt; command followed by the desired group name. For example, to create a new group called &lt;code&gt;mygroup&lt;/code&gt;, we would type &lt;code&gt;groupadd mygroup&lt;/code&gt;. We can then use the &lt;code&gt;usermod&lt;/code&gt; command to add users to the group, just like we did earlier. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;usermod -aG mygroup john

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would add the user john to the &lt;code&gt;mygroup&lt;/code&gt; group. It's like giving john a promotion or adding a new skill to their virtual resume!&lt;/p&gt;

&lt;p&gt;To delete a user,we have to use the &lt;code&gt;deluser&lt;/code&gt; or &lt;code&gt;userdel&lt;/code&gt; command followed by the username. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;deluser john

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would delete the user john and their home directory. We have to be careful with this command, as it cannot be undone! It's like virtual death – we won't be able to bring john back to life.&lt;/p&gt;

&lt;p&gt;To delete a group,we should use the &lt;code&gt;delgroup&lt;/code&gt; or &lt;code&gt;groupdel&lt;/code&gt; command followed by the group name. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;delgroup mygroup

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would delete the group &lt;code&gt;mygroup&lt;/code&gt;. Again,we have to be careful with this command as it cannot be undone! It's like a virtual extinction event – we won't be able to bring &lt;code&gt;mygroup&lt;/code&gt; back from the dead 💀.&lt;/p&gt;

&lt;h2&gt;
  
  
  Securing our System
&lt;/h2&gt;

&lt;p&gt;Now that we've mastered user and group management, let's move on to securing our system. One of the most important things we can do to keep our system safe is to keep it up to date. Ubuntu has a built-in update manager that makes it easy to install security updates and other important software updates. We have to simply open the Update Manager from the Applications menu and click the "Install Updates" button. It's like a security blanket for our system (or a tinfoil hat, depending on our level of paranoia).&lt;/p&gt;

&lt;p&gt;Another way to secure our system is to use a firewall. If we're running a network, we definitely want a firewall to be our first line of defense against any unwanted incoming or outgoing traffic. Firewalls are a key component of any system's security infrastructure, as they help to control incoming and outgoing network traffic based on predetermined security rules.&lt;/p&gt;

&lt;p&gt;In Ubuntu, we can enable the firewall by opening the terminal and typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw enable

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the firewall is enabled, we can use the &lt;code&gt;ufw&lt;/code&gt; command to add rules to allow or block specific types of traffic. For example, to allow incoming HTTP traffic (for web browsing), we would type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ufw allow http

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To block incoming HTTP traffic, we would type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ufw deny http

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To view the current firewall rules, we can use the &lt;code&gt;ufw status&lt;/code&gt; command, which will display a list of the currently active rules.&lt;/p&gt;

&lt;p&gt;It's important to note that while a firewall can help protect our system from external threats, it won't stop us from installing potentially sketchy programs from the internet or protect against other security risks such as malware or phishing attacks. That's why it's also important to be cautious when browsing the internet and to use strong passwords to protect our accounts.&lt;/p&gt;

&lt;p&gt;A strong password 🔒 is long and complex, making it difficult for attackers to guess. A good rule of thumb is to use a passphrase instead of a password, such as "I like to dance in the rain with unicorns" (just make sure to use a unique passphrase that we haven't used elsewhere). It's also a good idea to use a combination of letters, numbers, and special characters in our passwords to make them even more secure.&lt;br&gt;
We can use the self proclaimed most strong and complicated: Drumrolls! It's &lt;code&gt;DT&lt;/code&gt;.(PS. Don't use it else we even can't open it 😂 🤣 &lt;/p&gt;

&lt;p&gt;In conclusion, managing users and groups and securing our system in Ubuntu is important to keep our data and resources safe. By following best practices such as enabling the firewall and using strong passwords, we can help protect 🛡️ our system 💻 from external threats and keep our data and resources secure. So, it is always a good practice to be cautious and proactive about the security of our system.&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
    <item>
      <title>5 Steps to Getting Started with Ubuntu: A Beginner's Guide to the Popular Linux OS</title>
      <dc:creator>Jyoti Prakash Sethy</dc:creator>
      <pubDate>Tue, 27 Dec 2022 16:47:43 +0000</pubDate>
      <link>https://dev.to/jyoti_prakash_25/5-steps-to-getting-started-with-ubuntu-a-beginners-guide-to-the-popular-linux-os-ah7</link>
      <guid>https://dev.to/jyoti_prakash_25/5-steps-to-getting-started-with-ubuntu-a-beginners-guide-to-the-popular-linux-os-ah7</guid>
      <description>&lt;p&gt;Ubuntu is a popular open-source operating system that is based on the Debian Linux distribution. It is known for its ease of use and versatility, and is a great choice for those who are new to Linux or looking for a user-friendly alternative to other operating systems. In this article, we will go over the steps you need to take to get started with Ubuntu, including how to install it on your computer and how to perform some basic tasks.&lt;/p&gt;

&lt;p&gt;Before we begin, it's important to note that there are two main versions of Ubuntu: the Long Term Support (LTS) version, which is released every two years and is supported for five years, and the interim version, which is released every six months and is supported for nine months. The LTS version is generally more stable and is recommended for use in production environments, while the interim version is more suitable for testing and experimentation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqjmjom8hht9dne74g56i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqjmjom8hht9dne74g56i.png" alt="About Page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Ubuntu
&lt;/h2&gt;

&lt;p&gt;The first step in getting started with Ubuntu is to install it on your computer. Here's how to do it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Download the Ubuntu installation image from the official Ubuntu website (&lt;a href="https://ubuntu.com/download/desktop" rel="noopener noreferrer"&gt;https://ubuntu.com/download/desktop&lt;/a&gt;). You can choose between the LTS version and the interim version, as well as between 32-bit and 64-bit architectures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a bootable USB drive or DVD using the installation image you downloaded. There are several tools you can use to do this, such as Etcher (&lt;a href="https://www.balena.io/etcher/" rel="noopener noreferrer"&gt;https://www.balena.io/etcher/&lt;/a&gt;) or Rufus (&lt;a href="https://rufus.ie/" rel="noopener noreferrer"&gt;https://rufus.ie/&lt;/a&gt;). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Restart your computer and boot from the USB drive or DVD you created. You may need to enter the BIOS or UEFI settings and change the boot order to boot from the USB drive or DVD first.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow the prompts to install Ubuntu on your computer. You will be asked to select your language, create a user account, and choose a few other options. Be sure to create a strong password for your user account, as this will be the main account you use to log in to Ubuntu.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the installation is complete, remove the USB drive or DVD and restart your computer. You should now see the Ubuntu login screen. Enter your username and password to log in.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Using the Ubuntu Desktop
&lt;/h2&gt;

&lt;p&gt;The Ubuntu desktop is based on the Gnome desktop environment, which is known for its simplicity and ease of use. When you log in to Ubuntu for the first time, you will see the desktop with the top panel, the dock, and the desktop itself.&lt;/p&gt;

&lt;p&gt;The top panel contains the menu, the system tray, and the clock. You can use the menu to access applications, settings, and other features. The system tray contains icons for various system functions and notifications. The clock shows the current time and date.&lt;/p&gt;

&lt;p&gt;The dock is a vertical bar on the left side of the screen that contains icons for your favorite applications. You can add or remove icons from the dock by right-clicking on them and selecting "Add to Favorites" or "Remove from Favorites."&lt;/p&gt;

&lt;p&gt;The desktop itself is the main workspace where you can launch applications, create documents, and perform other tasks. You can also add icons to the desktop to quickly access your files and folders.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using the Terminal
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6brt199i5yzbgdgs09e2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6brt199i5yzbgdgs09e2.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The terminal is a command-line interface (CLI) that allows you to enter commands and execute them directly on the operating system. It is an essential tool for advanced users, but can also be useful for beginners who want to learn more about how the operating system works.&lt;/p&gt;

&lt;p&gt;To open the terminal, click on the Activities button in the top left corner of the screen and type "terminal" in the search bar. Alternatively, you can use the keyboard shortcut Ctrl+Alt+T to open the terminal.&lt;/p&gt;

&lt;p&gt;Once the terminal is open, you can enter commands by typing them and pressing Enter. Some basic commands you might find useful include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ls&lt;/strong&gt;: Lists the files and directories in the current directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1639sejffkbxi1uzpx6r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1639sejffkbxi1uzpx6r.png" alt="Terminal illustrating ls command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;cd&lt;/strong&gt;: Changes the current directory. For example, cd Documents would change the current directory to the "Documents" folder.    &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;pwd&lt;/strong&gt;: Prints the current directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;mkdir&lt;/strong&gt;: Creates a new directory. For example, mkdir new_folder would create a new folder called "new_folder" in the current directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;rm&lt;/strong&gt;: Removes a file or directory. For example, rm file.txt would delete the file "file.txt" in the current directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;sudo&lt;/strong&gt;: Runs a command with root privileges. This is often required to perform certain tasks that require elevated privileges, such as installing software or modifying system settings.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many other commands you can use in the terminal, and you can find more information about them by using the man command followed by the name of the command you want to learn about. For example, man ls would show the manual page for the ls command.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Software
&lt;/h2&gt;

&lt;p&gt;Ubuntu comes with a wide range of applications pre-installed, including &lt;strong&gt;a web browser&lt;/strong&gt;, &lt;strong&gt;an email client&lt;/strong&gt;, &lt;strong&gt;a text editor&lt;/strong&gt;, and other tools. However, you may want to install additional software that is not included by default.&lt;/p&gt;

&lt;p&gt;There are two main ways to install software on Ubuntu: using the Ubuntu Software Center or using the terminal.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Ubuntu Software Center&lt;/strong&gt; is a graphical application that allows you to browse and install a variety of software packages. To access it, click on the Activities button in the top left corner of the screen and type "software" in the search bar. Alternatively, you can click on the "Software" icon in the dock.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjhl8k5uz24y8k3c0user.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjhl8k5uz24y8k3c0user.png" alt="Ubuntu SOftware Center"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have opened the Ubuntu Software Center, you can search for a specific piece of software or browse through the available categories. To install a piece of software, simply click on the "Install" button next to it. You may be prompted to enter your password to confirm the installation.&lt;/p&gt;

&lt;p&gt;If you prefer to use the terminal, you can use the apt-get command to install software. For example, to install the Firefox web browser, you would enter the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt-get install firefox&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can also use the apt-cache command to search for available software packages. For example, to search for all packages that contain the word "editor," you would enter the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;apt-cache search editor&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Updating and Upgrading Ubuntu
&lt;/h2&gt;

&lt;p&gt;It is important to keep your operating system and software up to date to ensure that you have the latest security patches and bug fixes. In Ubuntu, you can use the "Software Updater" application to update your system and installed software.&lt;/p&gt;

&lt;p&gt;To access the Software Updater, click on the Activities button in the top left corner of the screen and type "updater" in the search bar. Alternatively, you can click on the "Software Updater" icon in the dock.&lt;/p&gt;

&lt;p&gt;Once you have opened the Software Updater, it will automatically check for available updates and display a list of the updates that are ready to be installed. Simply click on the "Install Now" button to install the updates. You may be prompted to enter your password to confirm the installation.&lt;/p&gt;

&lt;p&gt;If you prefer to use the terminal, you can use the apt-get command to update and upgrade your system. To update the package list and upgrade all installed packages to the latest version, enter the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt-get update &amp;amp;&amp;amp; sudo apt-get upgrade&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwwwso49guf3h4jimhmaz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwwwso49guf3h4jimhmaz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also use the apt-get dist-upgrade command to upgrade to a new version of Ubuntu. This command will install any new packages that are required to upgrade to the new version, as well as remove any obsolete packages.&lt;/p&gt;

&lt;p&gt;It is generally a good idea to run the update and upgrade commands on a regular basis to ensure that your system is up to date. You can also set up automatic updates by going to the "Software &amp;amp; Updates" settings and selecting the "Automatically check for updates" option.&lt;/p&gt;

&lt;h2&gt;
  
  
  Customizing Ubuntu
&lt;/h2&gt;

&lt;p&gt;One of the great things about Ubuntu is that you can customize it to suit your needs and preferences. Here are a few ways you can customize your Ubuntu installation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Change the desktop background: To change the desktop background, right-click on the desktop and select "Change Desktop Background." You can choose from a selection of built-in backgrounds or select your own image from your computer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change the desktop theme: To change the desktop theme, go to the "Appearance" settings and select a different theme from the drop-down menu. You can also install additional themes from the Ubuntu Software Center or from other sources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install additional desktop environments: Ubuntu comes with the Gnome desktop environment pre-installed, but you can install other desktop environments, such as KDE, Xfce, or Cinnamon, if you prefer a different look and feel. You can install additional desktop environments from the Ubuntu Software Center or from the terminal using the apt-get command.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install additional applications: As mentioned earlier, you can install additional applications from the Ubuntu Software Center or from the terminal using the apt-get command. There are thousands of applications available for Ubuntu, including productivity tools, games, and more.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In conclusion, Ubuntu is a powerful and user-friendly operating system that is suitable for a wide range of tasks. Whether you are a beginner or an experienced user, you can find a lot to like about Ubuntu, and with a little bit of customization, you can make it your own.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>ubuntu</category>
      <category>getttingstarted</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
