<?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>Forem: shyynux</title>
    <description>The latest articles on Forem by shyynux (@shyynux).</description>
    <link>https://forem.com/shyynux</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%2F1166650%2F665fb8e3-baa8-43a3-8621-0186208db363.jpeg</url>
      <title>Forem: shyynux</title>
      <link>https://forem.com/shyynux</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shyynux"/>
    <language>en</language>
    <item>
      <title>snow : saas starter kit</title>
      <dc:creator>shyynux</dc:creator>
      <pubDate>Sun, 01 Sep 2024 22:24:09 +0000</pubDate>
      <link>https://forem.com/shyynux/snow-saas-starter-kit-3p7m</link>
      <guid>https://forem.com/shyynux/snow-saas-starter-kit-3p7m</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/neon"&gt;Neon Open Source Starter Kit Challenge &lt;/a&gt;: Ultimate Starter Kit&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  About Snow
&lt;/h2&gt;

&lt;p&gt;Snow is a comprehensive developer kit designed to supercharge your SaaS development process. Built with simplicity and efficiency in mind, Snow provides everything you need to build, deploy, and scale your SaaS application quickly and effortlessly.&lt;/p&gt;

&lt;p&gt;Snow is designed for developers who want to accelerate their SaaS development without sacrificing quality. With built-in integrations and a streamlined setup, Snow eliminates the hassle of configuring essential tools, allowing you to focus on what truly matters—building great software.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Kit
&lt;/h2&gt;

&lt;p&gt;This is the link to the kit : &lt;a href="https://github.com/shyynux/snow" rel="noopener noreferrer"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I built Snow?
&lt;/h2&gt;

&lt;p&gt;A lot of times when I get ideas, I quickly want to build, but the setup and everything takes so much time. It kind of sucks out the fun of building. &lt;br&gt;
I know most of us can relate to this feeling.&lt;br&gt;
With Snow, You do not need to worry about all this, since the hero section, the landing page, the ORM (drizzle) and the database postgres(neon) is already set up for you. I also plan to setup auth and payments integration. The verification takes some time for Stripe so I will be including it a few days after the launch, but if your country supports quick, I request you to do for the meantime. &lt;/p&gt;

&lt;p&gt;Comparable to products which cost around &lt;strong&gt;$150+&lt;/strong&gt;, snow promises to provide the same services with &lt;strong&gt;1/3rd of the cost&lt;/strong&gt;. It has a free tier as well.  &lt;/p&gt;

&lt;p&gt;I am excited to share snow with everyone. &lt;/p&gt;

&lt;p&gt;Also, this product is specifically for builders, so let me know what is that one thing that annoys you or you constantly need, I will add it in the starter kit. Open to feedback and suggestions. &lt;/p&gt;

&lt;p&gt;Have a nice week :)&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>neonchallenge</category>
      <category>postgres</category>
      <category>database</category>
    </item>
    <item>
      <title>What is System design? &amp; terms you should know before diving deep into system design.</title>
      <dc:creator>shyynux</dc:creator>
      <pubDate>Thu, 14 Mar 2024 19:31:39 +0000</pubDate>
      <link>https://forem.com/shyynux/what-is-system-design-terms-you-should-know-before-diving-deep-into-system-design-3jij</link>
      <guid>https://forem.com/shyynux/what-is-system-design-terms-you-should-know-before-diving-deep-into-system-design-3jij</guid>
      <description>&lt;p&gt;Hi everyone, recently I got hooked into system design and I wanted to share this knowledge. A lot of things started making sense once I started deep diving into system design. I am very excited to share this with the world. Before we go deeper, let us understand what System design actually means.&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%2Fmedia1.tenor.com%2Fm%2FDMTM8AXw0N8AAAAC%2Fyes-todd-chavez.gif" 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%2Fmedia1.tenor.com%2Fm%2FDMTM8AXw0N8AAAAC%2Fyes-todd-chavez.gif" alt="Todd is excited."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;System design aims to design &lt;strong&gt;scalable, reliable and maintainable&lt;/strong&gt; systems. Every system is unique and the design should be catered to the specific situation. (&lt;em&gt;I talk about the terms like scalable and reliable below, don’t worry&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;System design is basically designing scalable, reliable and highly efficient systems that are fault tolerant and meets all the business requirements as well. &lt;/p&gt;

&lt;p&gt;It simplifies and explains the components, APIs, data models and the relationship and dependencies among them. &lt;/p&gt;

&lt;p&gt;Obviously no design is perfect and there is always a scope of improvement, but we always try to pick the most optimized and correct solution according to our needs. We also consider our limitations like cost etc.&lt;/p&gt;

&lt;p&gt;For example - If we have a lot of unstructured data, we would prefer NoSQL or maybe a combination of the different types of databases. Or if we are expecting a lot of data in blob format (images/videos), we will use something like S3 buckets with a CDN solution. If these terms scare you, &lt;em&gt;don’t worry&lt;/em&gt;, coz I used to feel the same whenever I used to see the word CDN. (it gets better)&lt;/p&gt;

&lt;p&gt;🤔 &lt;strong&gt;&lt;em&gt;But why system design, why can’t we code directly?&lt;/em&gt;&lt;/strong&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%2Fmedia1.tenor.com%2Fm%2Fs13kYGmcGbUAAAAC%2Fbut-why-sr-pelo.gif" 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%2Fmedia1.tenor.com%2Fm%2Fs13kYGmcGbUAAAAC%2Fbut-why-sr-pelo.gif" alt="But why"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You can&lt;/em&gt;, it will take more time, more redos and it will be far less efficient and way CHAOTIC. &lt;br&gt;
Why would you hammer a nail with your hand, when you can actually use a hammer. I know lame example, but I hope you got the point. Doing a huge task without planning and with planning, the difference is insane. A well designed system is scalable, performs better and makes your life easier as a dev.&lt;/p&gt;

&lt;p&gt;Let us understand the building blocks or the basic stuff you need to know before attempting to design systems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalable&lt;/strong&gt;: Scalability means the system should function properly when the system has grown from x to 100x (or 200x) users, or when the system is processing larger volumes of data than before. In other words, the system should be ‘scalable’ as in able to handle scale.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reliable&lt;/strong&gt;: The system should perform as expected by the user in all conditions, it should not break in case the user makes mistakes, and should be able to handle the load. Basically it should be reliable in all scenarios and work as expected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Maintainable&lt;/strong&gt;: Once the system is up and running, over the years, the main task is to maintain it and keep it running. Being maintainable means the system should function properly over time and adapting new functionalities should be smooth. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Load balancer&lt;/strong&gt;: Responsible for dividing the load among servers, so that the service functions correctly in case the load is increased. It distributes the load coming from users to all the different servers so there is not load only on one server. Helps in achieving scalability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Caching&lt;/strong&gt;: By caching we mean that storing frequently needed data or computational results, by doing this we do not need to query the database or compute those results for each request.. So you can think of a cache like a smaller and faster storage. Common examples: redis, memcached. It reduces latency and improves user experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CDN&lt;/strong&gt;: CDN or content delivery network, caching and distributing data to hundreds or billions of users. Distributing our data to a number of users. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API&lt;/strong&gt;: APIs or application programming interface is an effective way to communicate between users and backend servers or from one server to another. Commonly we use REST APIs in modern system designs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DNS&lt;/strong&gt;: DNS or domain name server,translates domain names to IP addresses so browsers can load Internet resources. In simple words, the public address of the server, in human readable form.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Databases&lt;/strong&gt;: Storage for data so to access it later, when you are designing your system, you would not want to worry about how to store the data, where to store the data so we depend on databases or databases management systems. We have a wide range of databases, and we choose them according to the type and amount of data and our budget. A lot of times we use a combination of different database options to fulfill our needs. Examples include PostgreSQL, MySQL, MongoDB, AWS DynamoDB, and Cassandra. (etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Database Sharding&lt;/strong&gt;: Dividing your database into shards, or partitions, makes it faster as queries now has to deal with lesser data. Ex- 4 million data is divided into 4 shards, so now every query will read just 1 million data, so faster. We need to consider query routing mechanisms. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Messaging queues&lt;/strong&gt;: Helpful in asynchronous flow and makes the system fault tolerant. Examples: Rabbit MQ, Amazon SQS &lt;a href="https://dev.to/shyynux/what-are-messaging-queues-5a5h"&gt;(Read bout it)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rate limiter:&lt;/strong&gt; No matter how scalable your system is, there is always a limit, suppose there is a malicious user who is sending too many requests, there will come a point when your service will start overloading or malfunctioning, we do not want this scenario. We want our users to be able to rely on our system, Rate limiting means limiting the number of requests per second or per minute according to our need. There are multiple ways, for ex: we can limit API calls made to our backend per second from an IP address.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Micro-services and monolithic architecture:&lt;/strong&gt; Well in simple words, micro services based architecture has different independent services for different things or functions, code is loosely coupled, easier to maintain and update, flexible. Monoliths are the opposite, one whole service has all the parts. It is faster and simpler to develop, easier to debug,  you might have seen this a lot in open source or personal projects. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Logging&lt;/strong&gt;: A mechanism to keep logs of what happened in our system, so that we can debug later in case our system runs into an issue. For ex: whenever a metric spiked we can see on AWS Cloudwatch to see what went wrong.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Elastic Search&lt;/strong&gt;: A lot of systems need search functionalities these days, where the user can enter a text or query and get results. We can query in a traditional database but it has a lot of intricacies, here comes elastic search. It is a text search engine built on Apache Lucene, (it has Fuzzy search, because we do not want the system to break when the user types bracekets instead of bracelets). &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A lot of the topics need detailed discussion which I will talk about in later blogs. This is a system design blog series. We will learn more as we go down this journey. Feel free to google the topics and learn more about them. &lt;/p&gt;

&lt;p&gt;I hope you enjoy designing systems. :) &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%2Fmedia1.tenor.com%2Fm%2Fx6lingdL5nwAAAAC%2Fvintage-blowkiss.gif" 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%2Fmedia1.tenor.com%2Fm%2Fx6lingdL5nwAAAAC%2Fvintage-blowkiss.gif" alt="have fun :)"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introduction to typescript</title>
      <dc:creator>shyynux</dc:creator>
      <pubDate>Fri, 20 Oct 2023 14:39:04 +0000</pubDate>
      <link>https://forem.com/shyynux/introduction-to-typescript-303o</link>
      <guid>https://forem.com/shyynux/introduction-to-typescript-303o</guid>
      <description>&lt;p&gt;Hi friends, so I am from the C++ and the Java world, but I have always been interested in web development so I finally took the plunge and went into the JS world. &lt;/p&gt;

&lt;p&gt;JS is wild. I was amazed, it’s like you have no rules. You don’t even need to write ‘int x’ if you want to use x as an integer, just do ‘let x’ and x is yours. I was enjoying building my project using MERN but as an open-source lovr, I wanted to contribute to projects. While diving into those projects, I realised that big projects that interest me use Typescript and something called monorepo (nothing but one single repo for all the things your project needs).&lt;/p&gt;

&lt;p&gt;Now TypeScript, sweet TypeScript, is actually a superset of JS, whatever you write in JS you can write in TS(but don’t). Coming from a C++ background I felt validated, because in TS you have to define the types, for example you can do this in JS,&lt;/p&gt;

&lt;p&gt;var x = 42;&lt;br&gt;
x = “noob”;&lt;/p&gt;

&lt;p&gt;and no one will say a word.&lt;/p&gt;

&lt;p&gt;But in TS, if you do this, it will start crying because you defined x as a number.&lt;/p&gt;

&lt;p&gt;var x: number = 42&lt;br&gt;
x = “noob” /* invalid */&lt;/p&gt;

&lt;p&gt;which is not a bad thing tbh.&lt;/p&gt;

&lt;h3&gt;
  
  
  🚀 How does the ts code is compiled?
&lt;/h3&gt;

&lt;p&gt;The typescript compiler or the tsc does not compiles the code, it does two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;type checks the code&lt;/li&gt;
&lt;li&gt;converts ts code to js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And then the js code is compiled.&lt;br&gt;
Pretty cool, right? 🚀 You can actually see that js file being created beside your ts file.&lt;/p&gt;

&lt;p&gt;Anyways getting to the official definition,&lt;/p&gt;

&lt;p&gt;“TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.”&lt;/p&gt;

&lt;p&gt;Also fun fact, it was developed by Anders Hejlsberg, from Microsoft.&lt;/p&gt;

&lt;p&gt;I will share more technical details later in this series where I deep dive and code with TypeScript.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
    </item>
    <item>
      <title>What is tree data structure? 🌳</title>
      <dc:creator>shyynux</dc:creator>
      <pubDate>Tue, 17 Oct 2023 19:39:21 +0000</pubDate>
      <link>https://forem.com/shyynux/what-are-tree-data-structure-gck</link>
      <guid>https://forem.com/shyynux/what-are-tree-data-structure-gck</guid>
      <description>&lt;p&gt;Today we are going to discuss:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is a tree?&lt;/li&gt;
&lt;li&gt;Basic tree terminologies&lt;/li&gt;
&lt;li&gt;Types of trees&lt;/li&gt;
&lt;li&gt;Operations on trees&lt;/li&gt;
&lt;li&gt;Some practice questions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌳 What is a tree?
&lt;/h3&gt;

&lt;p&gt;Trees are hierarchical data structures used to organize and represent data in a manner that resembles a tree with a root at the top and branches connecting nodes. Each node can have child nodes, creating a parent-child relationship. &lt;/p&gt;

&lt;p&gt;Tree data structures have various real-world applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;File Explorer&lt;/strong&gt;: Trees organize files and folders hierarchically, making it easy to navigate and locate data on your device.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parsers (XML parser)&lt;/strong&gt;: Trees structure and interpret data from files like XML, allowing software to understand and process information effectively.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database for Indexing&lt;/strong&gt;: Trees enable efficient data storage and retrieval in databases, speeding up searches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DNS (Domain Name System)&lt;/strong&gt;: Trees convert domain names into IP addresses, facilitating internet communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trie (Autocomplete)&lt;/strong&gt;: Trees power autocomplete suggestions in search engines by quickly searching for and suggesting relevant terms or phrases as you type.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a7ZxxSbZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7w3271r2r8ehtu6wnw37.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a7ZxxSbZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7w3271r2r8ehtu6wnw37.png" alt="example-of-a-binary-tree" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🌳 Basic tree terminologies
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parent:&lt;/strong&gt; A node in a tree data structure that has one or more child nodes directly connected to it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Child:&lt;/strong&gt; A node in a tree data structure that is connected to a parent node.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Root:&lt;/strong&gt; The topmost node in a tree, serving as the starting point for traversing the structure. It has no parent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leaf:&lt;/strong&gt; A node in a tree that has no children, meaning it is a terminal node.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Internal Node:&lt;/strong&gt; A node in a tree that is not a leaf, which means it has one or more children.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level:&lt;/strong&gt; The position of a node within a tree, with the root node at level 0 and each subsequent level increasing by 1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sibling:&lt;/strong&gt; Nodes that share the same parent in a tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Degree of a Node:&lt;/strong&gt; The number of subtrees (children) connected to a node. Leaf nodes have a degree of 0.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Height of a Tree:&lt;/strong&gt; The length of the longest path from the root to a leaf node in the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Height of a Node:&lt;/strong&gt; The length of the longest path from the node to a leaf node in the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Depth of a Node:&lt;/strong&gt; The length of the path from the root to that node, measured in terms of the number of edges in the path.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌳 Types of trees
&lt;/h3&gt;

&lt;p&gt;Now that we know what a tree is, let use look into a few different types of trees. You must have came across a binary tree or a binary search tree.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;General Tree:&lt;/strong&gt; A tree structure where nodes can have any number of children, providing flexibility in organising hierarchical data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Binary Tree:&lt;/strong&gt; A tree in which each node can have at most two children, commonly used for efficient data organisation and traversal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Binary Search Tree (BST):&lt;/strong&gt; A binary tree where values are organised so that left children are smaller, and right children are equal to or greater than the parent, enabling efficient searching and sorting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AVL Trees:&lt;/strong&gt; A self-balancing binary search tree that ensures the height difference between left and right subtrees is kept to a minimum, guaranteeing efficient operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Red-Black Trees:&lt;/strong&gt; Another self-balancing binary search tree that maintains balance by using colored nodes and performing rotations, suitable for a variety of applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;N-ary Trees:&lt;/strong&gt; Trees where nodes can have more than two child nodes, allowing for versatile data representation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;B-Trees:&lt;/strong&gt; Self-balancing trees used for managing large datasets, frequently employed in databases and file systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;B+ Trees:&lt;/strong&gt; A variant of B-trees with enhanced properties, particularly useful for indexing large amounts of data in databases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Trie (Prefix Tree):&lt;/strong&gt; A tree structure optimized for storing and searching strings, commonly employed in applications such as autocomplete and spell-checking.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ternary Tree:&lt;/strong&gt; A tree with nodes that have exactly three children, often used in specialised scenarios requiring a three-way decision structure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Segment Tree:&lt;/strong&gt; A binary tree structure designed for efficient range queries, especially useful for finding intervals or segments that contain a given query point, offering fast retrieval in O(log n + k) time, where k represents the number of retrieved intervals or segments.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌳 Operations on trees
&lt;/h3&gt;

&lt;p&gt;We can perform a variety of operations on trees. Let us have a look on some of the common ones.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Insertion:&lt;/strong&gt; Add a new node with a given value to the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deletion:&lt;/strong&gt; Remove a specific node (and its subtree) from the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search:&lt;/strong&gt; Find a specific node with a given value in the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traversal:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inorder:&lt;/strong&gt; Visit nodes in sorted order (for binary search trees).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preorder:&lt;/strong&gt; Visit the current node before its children.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Postorder:&lt;/strong&gt; Visit the current node after its children.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level-order:&lt;/strong&gt; Visit nodes level by level, starting from the root.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find Minimum/Maximum:&lt;/strong&gt; Find the node with the smallest or largest value in the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Balancing:&lt;/strong&gt; Rebalance the tree to ensure that it maintains a specific structure, such as in AVL trees or Red-Black trees.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Height Calculation:&lt;/strong&gt; Calculate and return the height (or depth) of the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Count Nodes:&lt;/strong&gt; Count and return the number of nodes in the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Diameter Calculation:&lt;/strong&gt; Find the length of the longest path between any two nodes in the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lowest Common Ancestor (LCA):&lt;/strong&gt; Find the lowest common ancestor of two nodes in the tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking for Balance:&lt;/strong&gt; Verify whether the tree is balanced, ensuring the heights of subtrees do not differ by more than a certain threshold.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Serialization and Deserialization:&lt;/strong&gt; Convert the tree into a serial format for storage or transmission, and then reconstruct the tree from the serialized data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prefix Search (in Tries):&lt;/strong&gt; Search for words or strings based on a common prefix in a Trie data structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traversal for Specific Orderings:&lt;/strong&gt; Perform various tree traversals (e.g., in-order, preorder, postorder) with specific requirements or rules for processing nodes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pruning:&lt;/strong&gt; Remove specific nodes or subtrees from the tree based on certain conditions or criteria.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌳 Some practice questions
&lt;/h3&gt;

&lt;p&gt;To understand trees better and develop an intuition for solving tree problems, I recommend the following problems.&lt;/p&gt;

&lt;p&gt;Before anything else, Implement a simple BST with the functions to create node, insert node, delete node and tree-traversal, after that do the following questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/invert-binary-tree"&gt;Invert Binary Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree"&gt;Lowest Common Ancestor of a Binary Search Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/maximum-depth-of-binary-tree"&gt;Maximum Depth of Binary Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/balanced-binary-tree"&gt;Balanced Binary Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/diameter-of-binary-tree"&gt;Diameter of Binary Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/binary-tree-level-order-traversal"&gt;Binary Tree Level Order Traversal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/implement-trie-prefix-tree"&gt;Implement Trie (Prefix Tree)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/validate-binary-search-tree"&gt;Validate Binary Search Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree"&gt;Lowest Common Ancestor of a Binary Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/binary-tree-right-side-view"&gt;Binary Tree Right Side View&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/serialize-and-deserialize-binary-tree"&gt;Serialize and Deserialize Binary Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal"&gt;Construct Binary Tree from Preorder and Inorder Traversal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/minimum-height-trees"&gt;Minimum Height Trees&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/problems/kth-smallest-element-in-a-bst"&gt;Kth Smallest Element in a BST&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Links  -
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://leetcode.com/tag/binary-search-tree/"&gt;More questions relevant to BST &lt;/a&gt;: &lt;/li&gt;
&lt;li&gt;Run your c++ code online : &lt;a href="https://ideone.com/"&gt;https://ideone.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3schools.com/cpp/cpp_structs.asp"&gt;Structures in C++&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>tree</category>
      <category>datastructures</category>
    </item>
    <item>
      <title>What are messaging queues?</title>
      <dc:creator>shyynux</dc:creator>
      <pubDate>Thu, 12 Oct 2023 14:03:55 +0000</pubDate>
      <link>https://forem.com/shyynux/what-are-messaging-queues-5a5h</link>
      <guid>https://forem.com/shyynux/what-are-messaging-queues-5a5h</guid>
      <description>&lt;p&gt;One day a team-mate told me during a call to poll some messages from SQS, I was like ‘What’s SQS or polling’, they told me it is an asynchronous queue. I was like whaaat (in my mind), I was a new joinee(shy), I felt so dumb. But i hope you don’t (and you shouldn’t), so today we are going to understand -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is a messaging queue?&lt;/li&gt;
&lt;li&gt;An exploration of some popular messaging queues.&lt;/li&gt;
&lt;li&gt;Common terms related to messaging queues (SQS), yes polling as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  💡 What is a messaging queue?
&lt;/h3&gt;

&lt;p&gt;A messaging queue is a way for services to communicate with each other without having to wait for a response(asynchronously). Messages are stored in a queue until they are processed, and each message is only processed once. &lt;br&gt;
Message queues can be used to break down complex tasks into smaller, more manageable ones, and to make systems more scalable and reliable. They are used in serverless and micro-services architectures. &lt;/p&gt;

&lt;p&gt;A component called a producer adds a message to the queue. The message is stored on the queue until another component called a consumer retrieves the message and processes it.&lt;/p&gt;

&lt;p&gt;A simple example:&lt;/p&gt;

&lt;p&gt;Imagine a website that sells products. When a customer places an order, the website creates a message and puts it in a queue. A separate process then picks up the message from the queue and processes the order.&lt;br&gt;
This allows the website to continue processing other orders while the first order is being processed. It also makes the website more reliable, because if one process fails, another process can pick up the messages from the queue and continue processing them.&lt;/p&gt;

&lt;h3&gt;
  
  
  💡 Some popular messaging queues:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Amazon SQS: Amazon Simple Queue Service (Amazon SQS) offers a secure, durable, and available hosted queue that lets you integrate and decouple distributed software systems and components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rabbit MQ: An open-source message broker that implements the Advanced Message Queuing Protocol (AMQP).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Azure Service Bus: A cloud-based message broker that provides reliable and scalable messaging services for applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apache Kafka: A distributed streaming platform that allows applications to process streams of data in real time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apache ActiveMQ: ActiveMQ is a popular messaging service that facilitates disparate data at scale in enterprise systems.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What and when to use should be decided according to the scale, service, tech stack choice etc. factors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lQi-Fkn---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vdr2hqqp9xn4y4jr1nv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lQi-Fkn---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vdr2hqqp9xn4y4jr1nv.png" alt="sqs-logo" width="711" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  💡 Useful terms associated with SQS
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Amazon SQS(Simple queue Service):&lt;br&gt;
As mentioned above, it is a messaging queue service. Our system has producers, consumers using the queue i.e., SQS. The queue stores each message on multiple Amazon SQS servers to ensure that messages are not lost if a server fails.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Producer: The service or application that sends messages to a queue. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Consumer: The service that retrieves and processes messages from a queue, which were placed there by producers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Queue: The specific messaging queue being used (e.g., SQS has both simple and FIFO options).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Polling: The process of checking a queue for new messages. &lt;br&gt;
By default, short polling is used, where your application sends a ReceiveMessage request to AWS SQS. SQS checks a subset of servers for messages and sends a response immediately, even if no messages are found. On the other hand, long polling waits for new messages, checking all servers for a specific duration, and returns a response if messages are found, otherwise, it sends an empty response when the polling wait time expires.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dead-letter Queue (DLQ): A queue that stores messages that cannot be processed successfully by other source queues. This can happen for various reasons, such as if the message is invalid, too large, or if the consumer crashes. However, they are not created automatically; we need to create them first.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Queue Attributes: These include maximum message size, message retention period, redrive policy, and visibility timeout, which all affect how the messaging queue functions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I really hope this information will help in understanding MQs better. If you want to read more on this topic I will recommend a few resources -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/message-queue/"&gt;https://aws.amazon.com/message-queue/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/welcome.html"&gt;Amazon-SQS-official-documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.rabbitmq.com/getstarted.html"&gt;https://www.rabbitmq.com/getstarted.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me know what messaging queue you used for your service and why.&lt;br&gt;
Have a nice day. 🤍&lt;/p&gt;

</description>
      <category>aws</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
