<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by DEEPAK MALVIYA on Medium]]></title>
        <description><![CDATA[Stories by DEEPAK MALVIYA on Medium]]></description>
        <link>https://medium.com/@DeepakMalviya7?source=rss-e21031f77cae------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ePoJrJqEOoI1sDksUCcGNA.jpeg</url>
            <title>Stories by DEEPAK MALVIYA on Medium</title>
            <link>https://medium.com/@DeepakMalviya7?source=rss-e21031f77cae------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:10:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@DeepakMalviya7/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Bit Manipulations]]></title>
            <link>https://medium.com/@DeepakMalviya7/bit-manipulations-3cd44edecdbe?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cd44edecdbe</guid>
            <category><![CDATA[binary-operations]]></category>
            <category><![CDATA[bit-manipulation]]></category>
            <category><![CDATA[binary]]></category>
            <category><![CDATA[bitwise-operator]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Fri, 23 Feb 2024 03:21:01 GMT</pubDate>
            <atom:updated>2024-02-23T03:21:01.645Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Binary Number System:</strong></h3><p>The binary number system is a fundamental concept in computer science and digital electronics. Unlike the decimal number system, which uses digits from 0 to 9, the binary number system uses only two digits: 0 and 1. In binary, each digit is referred to as a bit, and the base of the system is 2.</p><p><strong>Importance of Binary Numbers: </strong>The significance of binary numbers lies in their direct correspondence to the underlying digital nature of electronic devices, particularly computers. Computers operate using binary signals, where the presence of electrical charge represents a binary digit (1) and the absence of charge represents another binary digit (0). This binary representation simplifies the design and operation of digital circuits and allows for precise control and manipulation of electronic data.</p><p><strong>Representation and Conversion: </strong>Writing numbers in binary follows a similar principle to the decimal system but uses powers of 2 instead of powers of 10. For instance, the binary number 11101 represents the sum of powers of 2 corresponding to the positions of the bits:</p><p>Place: 16 8 4 2 1 Digits: 1 1 1 0 1</p><p>The value of the binary number is calculated as follows: 1 × 16 + 1 × 8 + 1 × 4 + 0 × 2 + 1 × 1 = 29</p><p>Therefore, (11101)₂ equals 29 in the decimal system.</p><p>Binary numbers are fundamental in computer programming, data storage, and digital communication. Understanding binary representation and conversion is essential for working with binary data, bitwise operations, and low-level programming tasks. Mastery of binary numbers is a cornerstone skill for anyone pursuing a career in computer science, software engineering, or electrical engineering.</p><h3>Understanding Data Types in Computer Programming</h3><p>In computer programming, data types play a crucial role in defining the nature of data stored in memory. Since computers operate using binary representation, data types specify the format in which data is stored and manipulated. Let’s delve deeper into the types of data and their representations:</p><ol><li>Primitive Data Types: Primitive data types are built-in types provided by programming languages, allowing users to directly define variables with these types. They include:</li></ol><ul><li>Integer: Used for whole numbers, with a size of 4 bytes in most systems, capable of representing values from -2,147,483,648 to 2,147,483,647.</li><li>Float: Represents single-precision floating-point numbers, typically occupying 4 bytes.</li><li>Double: Represents double-precision floating-point numbers, occupying 8 bytes.</li><li>Char: Represents single characters, such as letters or symbols, stored in 1 byte of memory, with a range from -128 to 127.</li><li>Boolean: Represents true or false values, typically stored in 1 byte of memory.</li><li>Void: Denotes a data type with no value.</li></ul><ol><li>Derived Data Types: Derived data types are formed by combining primitive data types or other derived types. They include:</li></ol><ul><li>Function: Represents a callable unit of code.</li><li>Array: A collection of elements of the same data type, accessed by index.</li><li>Pointer: Stores memory addresses, pointing to the location of other variables.</li><li>Reference: Acts as an alias for an existing variable.</li></ul><ol><li>Abstract or User-Defined Data Types: Abstract data types are defined by users to encapsulate data and operations on that data. Examples include:</li></ol><ul><li>Class: A blueprint for creating objects, encapsulating data and methods.</li><li>Structure: Similar to a class but with default public access, used for grouping related data items.</li><li>Union: A special data structure that stores different data types in the same memory location.</li><li>Enumeration: Defines a set of named integer constants.</li><li>Typedef Defined Data Type: Allows users to create aliases for existing data types.</li></ul><p>Size and Range of Primitive Data Types: The size and range of primitive data types vary across different programming languages and systems. A common representation is as follows:</p><ul><li>int: 4 bytes, range from -2,147,483,648 to 2,147,483,647.</li><li>float: 4 bytes.</li><li>double: 8 bytes.</li><li>char: 1 byte, range from -128 to 127.</li></ul><p>Practical Examples: Using the size and range information, we can calculate the memory requirements of variables and data structures. For example:</p><ul><li>An array of 4 integers (int arr[4]) would occupy 16 bytes (4 elements x 4 bytes each).</li><li>Variables int a = 5; and char c = ‘a’; together would occupy 5 bytes.</li><li>A structure with members char c, char d, and int a would occupy 8 bytes due to structure padding.</li></ul><p>Understanding data types is essential for efficient memory management, ensuring proper representation of data, and writing robust and scalable code in computer programming.</p><h3>Bitwise Operators</h3><p>In computer programming, bitwise operators are used to perform operations at the binary level, manipulating individual bits of binary numbers. These operators are essential for low-level programming tasks and are directly supported by the processor, making them fast and efficient. Let’s explore the common bitwise operators and their functionalities:</p><ol><li>Bitwise AND (&amp;): Syntax: A &amp; B</li></ol><p>The bitwise AND operator performs a logical AND operation on each pair of corresponding bits of two operands. The result is 1 only if both bits are 1, otherwise, it’s 0.</p><p>Example: A = 21 (10101) B = 6 (00110) A &amp; B = 4 (00100)</p><ol><li>Bitwise OR (|): Syntax: A | B</li></ol><p>The bitwise OR operator performs a logical OR operation on each pair of corresponding bits of two operands. The result is 1 if at least one of the bits is 1.</p><p>Example: A = 21 (10101) B = 6 (00110) A | B = 23 (10111)</p><ol><li>Bitwise XOR (^): Syntax: A ^ B</li></ol><p>The bitwise XOR operator performs a logical XOR operation on each pair of corresponding bits of two operands. The result is 1 if the bits are different, otherwise, it’s 0.</p><p>Example: A = 21 (10101) B = 6 (00110) A ^ B = 19 (10011)</p><ol><li>Bitwise NOT (~): Syntax: ~A</li></ol><p>The bitwise NOT operator, also known as the complement operator, inverts each bit of the operand, changing 1s to 0s and vice versa.</p><p>Example: A = 21 (10101) ~A = -22 (01010) (represented as a two’s complement)</p><ol><li>Right Shift Operator (&gt;&gt;): Syntax: A &gt;&gt; x</li></ol><p>The right shift operator shifts the bits of the operand to the right by a specified number of positions (x). The vacated positions on the left are filled with the sign bit or 0s, depending on the signedness of the operand.</p><p>Example: A = 29 (11101) A &gt;&gt; 2 = 7 (00011)</p><ol><li>Left Shift Operator (&lt;&lt;): Syntax: A &lt;&lt; x</li></ol><p>The left shift operator shifts the bits of the operand to the left by a specified number of positions (x). The vacated positions on the right are filled with 0s.</p><p>Example: A = 29 (11101) A &lt;&lt; 2 = 116 (1110100)</p><p>Bitwise operators are commonly used in various programming scenarios, including optimization, cryptography, and low-level system programming. Understanding how bitwise operators work and when to use them is essential for writing efficient and optimized code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cd44edecdbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering the Top 5 C++ Coding Round Questions for Job Interviews]]></title>
            <link>https://medium.com/@DeepakMalviya7/mastering-the-top-5-c-coding-round-questions-for-job-interviews-6a870e2f3f93?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a870e2f3f93</guid>
            <category><![CDATA[coding-interview-problems]]></category>
            <category><![CDATA[top-cpp-coding]]></category>
            <category><![CDATA[cpp-coding-questions]]></category>
            <category><![CDATA[top-ten-coding-questions]]></category>
            <category><![CDATA[cppcoding]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Fri, 23 Feb 2024 03:06:43 GMT</pubDate>
            <atom:updated>2024-02-23T03:06:43.609Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction: In the competitive landscape of C++ programming job interviews, excelling in coding rounds is crucial for securing your dream position. To help you prepare effectively, we’ve compiled a comprehensive guide featuring the top 10 C++ coding questions commonly encountered in interviews. Each question is accompanied by detailed explanations and sample solutions, designed to enhance your problem-solving skills and boost your confidence during the coding round.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*glIHff6cyFD1rEamenb_nA.jpeg" /></figure><p><strong>Calculate the Total Sum of Numbers in a Given List:</strong> Problem Statement: Write a program that calculates the total sum of all numbers in a given list.</p><p>Sample Solution (C++):</p><pre>#include &lt;iostream&gt;<br>int main() {<br>    int sum = 0;<br>    int num;<br>    <br>    std::cout &lt;&lt; &quot;Enter numbers (0 to end): &quot;;<br>    while (std::cin &gt;&gt; num &amp;&amp; num != 0) {<br>        sum += num;<br>    }<br>    <br>    std::cout &lt;&lt; &quot;Total sum: &quot; &lt;&lt; sum &lt;&lt; std::endl;<br>    <br>    return 0;<br>}</pre><p>Explanation: This program continuously reads input numbers from the user until a zero is entered, adding each number to the sum variable. Finally, it prints the total sum.</p><p><strong>Calculate and Print the Sum of Integers from n to m:</strong> Problem Statement: Write a program to calculate and print the sum of all integers from n to m, inclusive, using a loop.</p><p>Sample Solution (C++):</p><pre>#include &lt;iostream&gt;<br>int main() {<br>    int n, m;<br>    int sum = 0;<br>    <br>    std::cout &lt;&lt; &quot;Enter the range (n and m): &quot;;<br>    std::cin &gt;&gt; n &gt;&gt; m;<br>    <br>    for (int i = n; i &lt;= m; ++i) {<br>        sum += i;<br>    }<br>    <br>    std::cout &lt;&lt; &quot;Sum of integers from &quot; &lt;&lt; n &lt;&lt; &quot; to &quot; &lt;&lt; m &lt;&lt; &quot;: &quot; &lt;&lt; sum &lt;&lt; std::endl;<br>    <br>    return 0;<br>}</pre><p>Explanation: This program calculates the sum of integers from n to m by iterating through each integer in the range and adding it to the sum.</p><p><strong>Calculate the Average of Five Numbers Entered by the User: </strong>Problem Statement: Write a function that returns the average of five numbers entered by the user. The function should take an array as input and output the result to the screen.</p><p>Sample Solution (C++):</p><pre>#include &lt;iostream&gt;<br>double calculateAverage(int numbers[]) {<br>    double sum = 0;<br>    for (int i = 0; i &lt; 5; ++i) {<br>        sum += numbers[i];<br>    }<br>    return sum / 5.0;<br>}<br>int main() {<br>    int numbers[5];<br>    <br>    std::cout &lt;&lt; &quot;Enter five numbers: &quot;;<br>    for (int i = 0; i &lt; 5; ++i) {<br>        std::cin &gt;&gt; numbers[i];<br>    }<br>    <br>    double average = calculateAverage(numbers);<br>    <br>    std::cout &lt;&lt; &quot;Average of the five numbers: &quot; &lt;&lt; average &lt;&lt; std::endl;<br>    <br>    return 0;<br>}</pre><p>Explanation: This program prompts the user to enter five numbers, stores them in an array, calculates their sum, and then divides the sum by 5 to obtain the average.</p><p><strong>Calculate the Square Root of an Integer: Problem Statement: </strong>Write a program to calculate the square root of an integer.</p><p>Sample Solution (C++):</p><pre>#include &lt;iostream&gt;<br>#include &lt;cmath&gt;<br>int main() {<br>    int number;<br>    <br>    std::cout &lt;&lt; &quot;Enter an integer: &quot;;<br>    std::cin &gt;&gt; number;<br>    <br>    double squareRoot = sqrt(number);<br>    <br>    std::cout &lt;&lt; &quot;Square root of &quot; &lt;&lt; number &lt;&lt; &quot;: &quot; &lt;&lt; squareRoot &lt;&lt; std::endl;<br>    <br>    return 0;<br>}</pre><p>Explanation: This program takes an integer input from the user, calculates its square root using the sqrt function from the cmath library, and then prints the result.</p><p><strong>Calculate the Factorial of an Integer: Problem Statement:</strong> Write a program to calculate the factorial of an integer.</p><p>Sample Solution (C++):</p><pre>#include &lt;iostream&gt;<br>int factorial(int n) {<br>    if (n == 0 || n == 1) {<br>        return 1;<br>    }<br>    return n * factorial(n - 1);<br>}<br>int main() {<br>    int number;<br>    <br>    std::cout &lt;&lt; &quot;Enter an integer: &quot;;<br>    std::cin &gt;&gt; number;<br>    <br>    int result = factorial(number);<br>    <br>    std::cout &lt;&lt; &quot;Factorial of &quot; &lt;&lt; number &lt;&lt; &quot;: &quot; &lt;&lt; result &lt;&lt; std::endl;<br>    <br>    return 0;<br>}</pre><p>Explanation: This program uses a recursive function to calculate the factorial of an integer by multiplying consecutive integers starting from 1 up to the given number.</p><p>Conclusion: Mastering these top 10 C++ coding round questions is essential for excelling in job interviews for C++ programming positions. By understanding the problem statements, analyzing sample solutions, and practicing coding, you can enhance your problem-solving skills and confidently tackle coding rounds during interviews. Remember to approach each question systematically, test your solutions thoroughly, and seek clarification if needed. With dedication and practice, you’ll be well-equipped to showcase your C++ proficiency and secure your desired job. Good luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a870e2f3f93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering the Top Interview Questions for Success in Your Job Hunt]]></title>
            <link>https://medium.com/@DeepakMalviya7/mastering-the-top-interview-questions-for-success-in-your-job-hunt-ead585a67a1e?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/ead585a67a1e</guid>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[technical-interview]]></category>
            <category><![CDATA[technical-interview-tips]]></category>
            <category><![CDATA[top-interview-questions]]></category>
            <category><![CDATA[job-interview-questions]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Fri, 23 Feb 2024 02:52:23 GMT</pubDate>
            <atom:updated>2024-02-23T02:52:23.996Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s competitive job market, being well-prepared for interviews can significantly boost your chances of landing your dream job. Whether you’re a seasoned professional or just starting your career, mastering the top interview questions is essential for success. In this article, we’ll delve into the most common and crucial interview questions across various industries and provide insights on how to answer them effectively.</p><ol><li><strong>“Tell me about yourself.”</strong> This open-ended question is often used as an icebreaker. Use it as an opportunity to provide a brief overview of your professional background, highlighting relevant experiences, skills, and achievements. Focus on aspects that align with the job requirements and company culture. Keep your response concise, engaging, and tailored to the position you’re applying for.</li><li><strong>“What are your strengths and weaknesses?”</strong> When discussing strengths, emphasize key skills and attributes that make you a valuable asset to the company. Provide specific examples to demonstrate how you’ve utilized these strengths in previous roles. For weaknesses, choose an area of improvement that is not critical to the job and discuss steps you’re taking to overcome it. Show self-awareness and a proactive attitude towards personal development.</li><li><strong>“Why do you want to work here?”</strong> This question assesses your motivation and interest in the company. Research the company thoroughly and identify what sets it apart from its competitors. Highlight specific aspects such as its mission, culture, products/services, or industry reputation that resonate with you. Tailor your response to showcase how your skills and goals align with the company’s objectives.</li><li><strong>“Describe a challenging situation you faced at work and how you handled it.”</strong> Employers use behavioral questions like this to evaluate your problem-solving and interpersonal skills. Choose a relevant example where you successfully resolved a challenging situation or conflict. Use the STAR method (Situation, Task, Action, Result) to structure your response, focusing on the actions you took and the positive outcomes achieved. Highlight your ability to remain calm under pressure and collaborate effectively with others.</li><li><strong>“Where do you see yourself in five years?” </strong>This question assesses your long-term career goals and aspirations. Demonstrate ambition and a clear vision for your future while also aligning your goals with the company’s growth trajectory. Emphasize your commitment to continuous learning and professional development, emphasizing how the position aligns with your career path.</li><li><strong>“Can you walk me through your resume?”</strong> Be prepared to provide a concise summary of your work experience, highlighting key roles, responsibilities, and accomplishments. Focus on quantifiable achievements and how they demonstrate your qualifications for the role. Tailor your response to emphasize relevant experiences that align with the job requirements.</li><li><strong>“What salary are you looking for?”</strong> This question requires research and preparation. Be ready to discuss salary expectations based on industry standards, your experience level, and the cost of living in the job location. Provide a salary range rather than a specific number, ensuring it aligns with your skills and the value you bring to the company.</li><li><strong>“Do you have any questions for us?”</strong> Always have insightful questions prepared to demonstrate your interest in the company and the role. Inquire about company culture, opportunities for growth and development, upcoming projects, or specific challenges the team is facing. Avoid asking about salary or benefits during the initial interview stages.</li></ol><p>In conclusion, mastering the top interview questions requires preparation, self-awareness, and effective communication skills. By understanding the purpose behind each question and crafting thoughtful responses, you can showcase your qualifications, enthusiasm, and fit for the role. Remember to practice mock interviews, research the company thoroughly, and approach each interview with confidence and professionalism. Good luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ead585a67a1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Matrix Chain Multiplication (MCM)]]></title>
            <link>https://medium.com/@DeepakMalviya7/matrix-chain-multiplication-mcm-d7f51ec5d319?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7f51ec5d319</guid>
            <category><![CDATA[chain]]></category>
            <category><![CDATA[pd]]></category>
            <category><![CDATA[matrix]]></category>
            <category><![CDATA[mcm]]></category>
            <category><![CDATA[matrix-chain-multipli]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Thu, 01 Feb 2024 11:20:25 GMT</pubDate>
            <atom:updated>2024-02-01T11:20:25.559Z</atom:updated>
            <content:encoded><![CDATA[<p>Given the dimensions of a sequence of matrices in an array arr[], where the dimension of the ith matrix is (arr[i-1] * arr[i]), the task is to find the most efficient way to multiply these matrices together, minimizing the total number of element multiplications.</p><h4>Examples:</h4><h4>Example 1:</h4><ul><li>Input: arr[] = {40, 20, 30, 10, 30}</li><li>Output: 26000</li><li>Explanation: There are 4 matrices of dimensions 40×20, 20×30, 30×10, 10×30. The optimal parenthesization is (A(BC))D, resulting in the minimum number of multiplications: 20*30*10 + 40*20*10 + 40*10*30.</li></ul><h4><strong>Example 2:</strong></h4><ul><li>Input: arr[] = {1, 2, 3, 4, 3}</li><li>Output: 30</li><li>Explanation: There are 4 matrices of dimensions 1×2, 2×3, 3×4, 4×3. The optimal parenthesization is ((AB)C)D, resulting in the minimum number of multiplications: 1*2*3 + 1*3*4 + 1*4*3.</li></ul><h4><strong>Example 3:</strong></h4><ul><li>Input: arr[] = {10, 20, 30}</li><li>Output: 6000</li><li>Explanation: There are only two matrices of dimensions 10×20 and 20×30. The only way to multiply the matrices is straightforward, resulting in a cost of 10*20*30.</li></ul><h3>Recursive Solution:</h3><p>The problem can be solved using recursion based on the following facts:</p><ul><li>Two matrices of size m x n and n x p when multiplied generate a matrix of size m x p, and the number of multiplications performed is m * n * p.</li><li>For a given chain of N matrices, the first partition can be done in N-1 ways.</li></ul><p>Here is the recursive solution in C++:</p><pre>#include &lt;bits/stdc++.h&gt;<br>using namespace std;<br><br>int MatrixChainOrder(int p[], int i, int j) {<br>    if (i == j)<br>        return 0;<br><br>    int mini = INT_MAX;<br>    int count;<br><br>    for (int k = i; k &lt; j; k++) {<br>        count = MatrixChainOrder(p, i, k) +<br>                MatrixChainOrder(p, k + 1, j) +<br>                p[i - 1] * p[k] * p[j];<br><br>        mini = min(count, mini);<br>    }<br><br>    return mini;<br>}<br><br>int main() {<br>    int arr[] = {1, 2, 3, 4, 3};<br>    int N = sizeof(arr) / sizeof(arr[0]);<br><br>    cout &lt;&lt; &quot;Minimum number of multiplications is &quot;<br>         &lt;&lt; MatrixChainOrder(arr, 1, N - 1);<br><br>    return 0;<br>}</pre><p>Output: Minimum number of multiplications is 30</p><p>This recursive solution has exponential time complexity and lacks efficiency due to recomputation of the same subproblems.</p><p>This recursive solution has exponential time complexity and lacks efficiency due to recomputation of the same subproblems.</p><h3>Dynamic Programming Solution with Memoization:</h3><p>To address the inefficiency, dynamic programming with memoization can be employed. The idea is to store the results of subproblems in a table (dp) and reuse them when needed.</p><p>Here is the memoized solution in C++:</p><p>Output: Minimum number of multiplications is 18</p><p>This memoized solution significantly reduces the time complexity by avoiding redundant computations.</p><p>This memoized solution significantly reduces the time complexity by avoiding redundant computations.</p><h3>Dynamic Programming Solution with Tabulation (Iterative Approach):</h3><p>The final approach is to use tabulation, which involves building the solution from the ground up.</p><p>Here is the iterative solution in C++:</p><p>Output: Minimum number of multiplications is 18</p><p>This iterative solution is more efficient than the recursive one and has a time complexity of O(N³)</p><p>This iterative solution is more efficient than the recursive one and has a time complexity of O(N³)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7f51ec5d319" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Catalan Number and its Applications]]></title>
            <link>https://medium.com/@DeepakMalviya7/what-is-catalan-number-and-its-applications-c9c8eda5f3bf?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9c8eda5f3bf</guid>
            <category><![CDATA[catalan]]></category>
            <category><![CDATA[parentheses-expressions]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[catalan-number]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Thu, 01 Feb 2024 11:02:54 GMT</pubDate>
            <atom:updated>2024-02-01T11:02:54.605Z</atom:updated>
            <content:encoded><![CDATA[<p>The Catalan numbers are a sequence of natural numbers that have many important combinatorial properties. They are named after the French-Belgian mathematician Eugène Charles Catalan, who investigated them in the 19th century. The nth Catalan number, often denoted as Cn, is given by the formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/269/1*b04BlKc6_zXRypacg7tMPw.png" /></figure><p>Catalan numbers can also be defined using following recursive formula.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/1*ESNbR8jdMK6Pk_Yz6fE8_Q.png" /></figure><p>Catalan numbers appear in various counting problems and combinatorial structures. Some of their applications include:</p><ol><li><strong>Parentheses Expressions:</strong> Catalan numbers count the number of different ways to arrange parentheses in a well-formed expression. For example, for n=3, the Catalan number C3 counts the different ways to arrange parentheses in expressions like (((()))), (()()), (())(), ()(()), and ()()().</li><li><strong>Binary Search Trees:</strong> Catalan numbers also represent the number of unique binary search trees with n+1 nodes. Each binary search tree can be uniquely identified by its in-order traversal.</li><li><strong>Triangulations of Convex Polygons:</strong> The Catalan numbers count the number of ways to partition a convex polygon into non-intersecting triangles by connecting its vertices.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ZALRG56xr88-4VZmZcnWhA.jpeg" /></figure><ol><li><strong>Dyck Paths:</strong> A Dyck path is a staircase path in the positive quadrant that starts at the origin, ends on the x-axis, and consists of steps U (up) and R (right) with the condition that it never goes below the x-axis. Catalan numbers count the number of Dyck paths of a given length.</li></ol><p><em>(I). UURR</em> (corresponding to (1,1)→(1,2)→(2,2)→(2,3)→(3,3) (1,1)→(1,2)→(2,2)→(2,3)→(3,3))</p><p><em>(II). URUR </em>(corresponding to (1,1)→(2,1)→(2,2)→(3,2)→(3,3)(1,1)→(2,1)→(2,2)→(3,2)→(3,3))</p><p><em>(III). URRU</em> (corresponding to (1,1)→(2,1)→(2,2)→(2,3)→(3,3)(1,1)→(2,1)→(2,2)→(2,3)→(3,3))</p><p><em>(IV). RUUR</em> (corresponding to (1,1)→(1,2)→(1,3)→(2,3)→(3,3)(1,1)→(1,2)→(1,3)→(2,3)→(3,3))</p><p><em>(V). RURU</em> (corresponding to (1,1)→(1,2)→(2,2)→(3,2)→(3,3)(1,1)→(1,2)→(2,2)→(3,2)→(3,3))</p><p><em>(VI). RRUU</em> (corresponding to (1,1)→(1,2)→(1,3)→(1,4)→(2,4)(1,1)→(1,2)→(1,3)→(1,4)→(2,4))</p><p><strong>5. Mountain Ranges and Valleys:</strong> Catalan numbers count the number of ways to arrange “up” and “down” steps in a sequence such that the path stays above the x-axis. Each peak in the path corresponds to a peak in a mountain range, and each valley corresponds to a valley between mountain ranges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Vmu4VQo3snRE25OjxBGjfA.jpeg" /></figure><p><strong>6. Non-Crossing Partitions:</strong> The Catalan numbers count the number of non-crossing partitions of a set with n+1 elements. A non-crossing partition is a way of dividing a set into subsets such that no two subsets intersect in a non-empty set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*DhLa4laE4lNkLsOsvcE6CQ.jpeg" /></figure><p>These are just a few examples, and Catalan numbers arise in various other combinatorial problems and mathematical contexts. Their recurrence relation and properties make them a fascinating and widely studied sequence in combinatorics.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9c8eda5f3bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebSocket]]></title>
            <link>https://medium.com/@DeepakMalviya7/websocket-c6a16308be5f?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6a16308be5f</guid>
            <category><![CDATA[websocket-api]]></category>
            <category><![CDATA[full-duplex]]></category>
            <category><![CDATA[websocket-server]]></category>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[what-is-websocket]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Mon, 22 Jan 2024 05:33:04 GMT</pubDate>
            <atom:updated>2024-01-22T05:36:24.599Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/249/1*CvnWilhM1fqR_p36elMyhg.png" /><figcaption>A diagram describing a connection using WebSocket</figcaption></figure><p>WebSocket is a communication protocol that provides full-duplex communication channels over a single, long-lived connection. It is designed to be implemented in web browsers and web servers but can be used in any application where real-time communication is needed.</p><p>Here are some key points about WebSocket:</p><ol><li><strong>Full-duplex Communication:</strong> Unlike traditional web communication, which is based on the request-response model, WebSocket allows for bidirectional communication. This means that both the client and server can send messages independently of each other.</li><li><strong>Persistent Connection:</strong> Once a WebSocket connection is established, it remains open, allowing for real-time data exchange without the need to repeatedly establish new connections.</li><li><strong>Low Latency:</strong> WebSocket reduces latency compared to traditional HTTP connections because it eliminates the need to repeatedly open and close connections for each communication.</li><li><strong>Lightweight Protocol:</strong> WebSocket is designed to be a lightweight protocol that minimizes the overhead of data exchange.</li><li><strong>Usage in Web Development: </strong>Web Sockets are commonly used in web development for applications that require real-time updates, such as chat applications, online gaming, financial trading platforms, and collaborative editing tools.</li><li><strong>WebSocket API:</strong> Browsers provide a JavaScript API (WebSocket API) that enables web applications to establish WebSocket connections. This API includes methods for opening, closing, and sending messages over WebSocket connections.</li></ol><p>Here’s a simple example of using WebSocket in JavaScript:</p><pre>// Create a WebSocket connection<br>const socket = new WebSocket(&#39;ws://example.com/socket&#39;);<br><br>// Event handler for when the connection is opened<br>socket.addEventListener(&#39;open&#39;, (event) =&gt; {<br>    console.log(&#39;WebSocket connection opened:&#39;, event);<br>    <br>    // Send a message to the server<br>    socket.send(&#39;Hello, server!&#39;);<br>});<br>// Event handler for when a message is received<br>socket.addEventListener(&#39;message&#39;, (event) =&gt; {<br>    console.log(&#39;Message from server:&#39;, event.data);<br>});<br>// Event handler for when the connection is closed<br>socket.addEventListener(&#39;close&#39;, (event) =&gt; {<br>    console.log(&#39;WebSocket connection closed:&#39;, event);<br>});</pre><h4>Using Node.js</h4><pre>import express from &quot;express&quot;;<br>import { WebSocketServer } from &#39;ws&#39;;<br><br>const app = express();<br>const port = 8000;<br><br>const server = app.listen(port, () =&gt; {<br>    console.log(&quot;server is listening...&quot;);<br>})<br><br><br>const wss = new WebSocketServer({ server });<br><br>wss.on(&#39;connection&#39;, (ws) =&gt; {<br>  ws.on(&#39;error&#39;, console.error);<br><br>  ws.on(&#39;message&#39;,  (data) =&gt; {<br>    console.log(&#39;received: %s&#39;, data);<br>    ws.send(&quot;Thanks Buddy&quot;);<br>  });<br><br>});</pre><p>On the server side, you would need to implement WebSocket handling based on the programming language and framework you are using.</p><p>It’s worth noting that while WebSocket is a powerful tool for real-time communication, it should be used judiciously, and considerations should be made for security and scalability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6a16308be5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event loop in JavaScript]]></title>
            <link>https://medium.com/@DeepakMalviya7/event-loop-in-javascript-a1f717b6f131?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1f717b6f131</guid>
            <category><![CDATA[settimeout]]></category>
            <category><![CDATA[philip-robert]]></category>
            <category><![CDATA[event-loop-in-javascript]]></category>
            <category><![CDATA[event-loop]]></category>
            <category><![CDATA[event-loop-in-js]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Fri, 15 Dec 2023 13:06:28 GMT</pubDate>
            <atom:updated>2023-12-15T13:09:39.743Z</atom:updated>
            <content:encoded><![CDATA[<p>In simple terms, an event loop in JavaScript is a mechanism that allows your code to handle asynchronous tasks, such as user input, network requests, or timers, without blocking the execution of the rest of your program. It ensures that your program remains responsive and can continue to perform tasks while waiting for certain operations to complete.</p><p>Here’s a basic explanation of how the event loop works:</p><ol><li><strong>Call Stack:</strong> This is where your synchronous code is executed. Each function call creates a new frame in the call stack.</li><li><strong>Callback Queue:</strong> Asynchronous tasks, like user input or timer events, are placed in a queue called the callback queue after they finish.</li><li><strong>Event Loop:</strong> This continuously checks the call stack and the callback queue. If the call stack is empty, it takes the first callback from the queue and pushes it onto the call stack, allowing it to be executed.</li></ol><p>Let’s look at a simple example:</p><pre>console.log(&quot;Start&quot;);<br>// Asynchronous function using setTimeout<br>setTimeout(function () {<br>  console.log(&quot;Inside setTimeout&quot;);<br>}, 2000);<br>console.log(&quot;End&quot;);</pre><p>In this example, “Start” and “End” will be logged first because they are part of the synchronous code. The setTimeoutfunction is asynchronous and will not block the execution of the rest of the code. After 2000 milliseconds (2 seconds), &quot;Inside setTimeout&quot; will be logged.</p><p>The event loop ensures that the timeout callback is placed in the callback queue, and when the call stack is empty, it will be pushed onto the call stack and executed.</p><p>Keep in mind that the event loop is a fundamental concept for understanding asynchronous programming in JavaScript. It’s crucial for handling tasks like user interactions, network requests, and timers in a non-blocking manner.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1f717b6f131" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is it possible to combine horizontal and vertical scaling strategies in a single system?]]></title>
            <link>https://medium.com/@DeepakMalviya7/is-it-possible-to-combine-horizontal-and-vertical-scaling-strategies-in-a-single-system-f1840376f300?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1840376f300</guid>
            <category><![CDATA[horizontal-scaling]]></category>
            <category><![CDATA[hybrid-scaling]]></category>
            <category><![CDATA[verticle-scaling]]></category>
            <category><![CDATA[hybrid-system]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Fri, 20 Oct 2023 06:07:29 GMT</pubDate>
            <atom:updated>2023-10-20T06:07:29.638Z</atom:updated>
            <content:encoded><![CDATA[<h3>Is it possible to combine horizontal and vertical scaling strategies in a single system? Why or why not?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4J4sG2r6BYfrW1NCJ9N0Tw.jpeg" /></figure><p>Yes, it is possible to combine horizontal and vertical scaling strategies in a single system, and this approach is commonly referred to as “hybrid scaling.” The decision to combine these scaling strategies is based on the specific needs and requirements of the system. Here’s why it can be done:</p><h4><strong>Scalability Requirements:</strong></h4><p>Different parts of a system may have varying scalability requirements. Some components may benefit from vertical scaling (adding more resources to a single server), while others may benefit from horizontal scaling (adding more servers). A hybrid approach allows you to address these diverse requirements effectively.</p><h4><strong>Cost Efficiency:</strong></h4><p>Vertical scaling typically involves adding more resources to a single server, which can become expensive as server specifications increase. Horizontal scaling, on the other hand, allows you to distribute the load across multiple, potentially more cost-effective servers. By combining both strategies, you can achieve a balance between performance and cost.</p><h4><strong>Flexibility:</strong></h4><p>Hybrid scaling provides flexibility in responding to changing demands. You can vertically scale specific resource-intensive components while horizontally scaling components that benefit from distribution. This adaptability allows you to allocate resources where they are needed most efficiently.</p><h4><strong>Redundancy and Fault Tolerance:</strong></h4><p>Horizontal scaling inherently provides redundancy and fault tolerance because if one server fails, the others can still handle the load. Combining vertical scaling with horizontal scaling can further enhance redundancy and fault tolerance by providing additional resources within each server while also distributing the load.</p><h4><strong>Performance Optimization:</strong></h4><p>A hybrid approach can be used to optimize the performance of critical components within a system. For instance, a database server might be vertically scaled to handle intensive read and write operations, while web servers are horizontally scaled to accommodate traffic spikes.</p><h4><strong>Load Balancing:</strong></h4><p>Load balancers can be used to distribute traffic among horizontally scaled servers. By combining this with vertical scaling, you can ensure that each server in the horizontal pool is also optimized for performance, further enhancing the system’s overall scalability and responsiveness.</p><p>It’s important to note that while combining these scaling strategies can offer numerous benefits, it also introduces complexity in terms of management, monitoring, and resource allocation. System administrators and architects need to carefully plan and design the system to ensure that both vertical and horizontal scaling components work harmoniously to meet the system’s goals.</p><p>The choice between vertical, horizontal, or hybrid scaling should be based on the specific use case, performance requirements, budget constraints, and the anticipated growth of the system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1840376f300" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Key components of a system: Clients, Servers, Databases, Caching, Load Balancing, Proxies]]></title>
            <link>https://medium.com/@DeepakMalviya7/key-components-of-a-system-clients-servers-databases-caching-load-balancing-proxies-6b195711946f?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b195711946f</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[load-balancing]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Thu, 19 Oct 2023 12:02:00 GMT</pubDate>
            <atom:updated>2023-10-19T12:02:00.387Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*h0IPI7P0-87GZCuyYqmkCw.jpeg" /></figure><h4>Clients</h4><p>Clients are the end-user or consumer-facing components of a system. They can be software applications, web browsers, or hardware devices that interact with the system to request and consume services or data. Clients initiate communication with servers to perform tasks or retrieve information.</p><h4>Servers</h4><p>Servers are the backbone of a system, responsible for processing client requests, executing business logic, and returning responses. Servers can be physical machines or virtual instances that run software applications to handle various tasks, such as web servers, application servers, or database servers.</p><h4>Databases</h4><p>Databases are essential for storing and managing structured data. They are used to store information such as user data, product information, transaction records, and more. Databases can come in various forms, including relational databases (e.g., MySQL, PostgreSQL), NoSQL databases (e.g., MongoDB, Cassandra), and in-memory databases.</p><h4>Caching</h4><p>Caching involves storing frequently accessed data in a high-speed memory or storage location to reduce the latency in retrieving that data. Caches can be implemented at different levels, such as client-side caching, server-side caching, or distributed caching. Caching helps improve system performance by reducing the need to retrieve data from the original data source.</p><h4>Load Balancing</h4><p>Load balancing is the distribution of network traffic or workloads across multiple servers or server instances to ensure efficient utilization of resources, improve system scalability, and enhance system reliability. Load balancers can distribute traffic based on various algorithms, such as round-robin, least connections, or application-specific criteria.</p><h4>Proxies</h4><p>Proxies act as intermediaries between clients and servers, forwarding client requests to the appropriate server and relaying server responses back to the clients. They can provide various services, including security, content filtering, and network optimization. Reverse proxies are commonly used in web applications to enhance security and performance.</p><p>These components are often combined and configured in complex ways to build scalable, reliable, and efficient systems. The specific architecture and configuration of these components can vary based on the requirements of the system, including factors like performance, fault tolerance, security, and scalability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b195711946f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Impact of AI: 10 Jobs Most at Risk of Automation]]></title>
            <link>https://medium.com/@DeepakMalviya7/the-impact-of-ai-10-jobs-most-at-risk-of-automation-91bcacdef247?source=rss-e21031f77cae------2</link>
            <guid isPermaLink="false">https://medium.com/p/91bcacdef247</guid>
            <category><![CDATA[ai-replacing-jobs]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-replacing-human]]></category>
            <category><![CDATA[ai-job-loss]]></category>
            <category><![CDATA[impact-of-ai]]></category>
            <dc:creator><![CDATA[DEEPAK MALVIYA]]></dc:creator>
            <pubDate>Wed, 11 Oct 2023 11:29:23 GMT</pubDate>
            <atom:updated>2023-10-11T11:29:23.227Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oT84FPxwWb27jzPEP1A5xg.png" /></figure><p>The rise of artificial intelligence (AI) is ushering in an era of transformation in the job market. AI and robotics are becoming increasingly sophisticated, and we frequently encounter robots performing tasks that were once only seen in science fiction movies. While the notion of AI can elicit both awe and apprehension, it&#39;s essential to understand the evolving landscape of employment.</p><p>As technology advances, AI is poised to replace certain jobs, making it important to address concerns about job security. However, it&#39;s crucial to recognize that, like past technological innovations, AI will create new opportunities while rendering some traditional jobs obsolete.</p><p>A recent report by Gartner suggests that AI will eliminate millions of jobs while simultaneously creating two million net-new jobs by 2025. In this article, we&#39;ll explore ten jobs that AI may replace and ten jobs that are less susceptible to automation.</p><p>Jobs AI Will Likely Replace</p><h4>Customer Service Representatives</h4><p>AI can efficiently respond to repetitive customer queries, such as order status, delivery confirmation, and payment issues, without requiring high levels of emotional or social intelligence. Frequently asked questions can be addressed by AI, with more complex issues forwarded to human customer service representatives.</p><h4>Receptionists</h4><p>Many companies now employ AI-driven receptionists, handling calls and scheduling appointments. Advanced AI receptionists can see, listen, comprehend, and converse with guests and customers, further reducing the need for human receptionists.</p><h4>Accountants/Bookkeepers</h4><p>AI-powered bookkeeping services offer efficient, secure, and cost-effective accounting solutions, eliminating the need for human bookkeepers. These cloud-based services can accurately collect, store, and analyze financial data.</p><h4>Salespeople</h4><p>Advertising and retail activities have shifted towards online platforms and social media, reducing the demand for traditional salespeople. AI-driven marketing and customer engagement strategies have transformed how businesses interact with customers, and autonomous retail experiences are becoming more common.</p><h4>Taxi and Truck Drivers</h4><p>Ride-hailing services like Uber and Lyft are moving towards autonomous driving, while the automotive industry is continually introducing AI features to vehicles. This shift will impact the jobs of taxi and truck drivers, potentially leading to job displacement.</p><h4>Retail Services</h4><p>AI-driven devices are taking on tasks in retail, such as tracking inventory, handling payments, and providing product recommendations. Self-service technologies and autonomous devices are changing the way we shop, reducing the need for human involvement.</p><h4>Proofreaders and Translators</h4><p>AI-powered tools, like Grammarly and translation software, can assist writers in checking readability, spelling, and grammar, making human proofreaders and translators less essential for certain tasks.</p><h4>Security and Military Personnel</h4><p>AI is transforming security and military operations, with robots and autonomous vehicles playing a more significant role in surveillance and potentially combat situations. These technologies aim to reduce the risk to human lives in these critical areas.</p><h4>Surgical Assistants</h4><p>Robotic surgeons are making significant strides in the medical field, performing operations with precision and reducing the risk of human error. As these technologies advance, human surgical assistants may see their roles diminished.</p><h4>Courier Services</h4><p>Companies like Walmart and Amazon are exploring the use of drones and robots for delivery services. As AI continues to streamline supply chain and logistics functions, traditional courier jobs may be replaced by automated delivery methods.</p><p>Conclusion</p><p>The impact of AI on the job market is undeniable, and it&#39;s essential to adapt to these changes by acquiring new skills and embracing the evolving work landscape. While AI is poised to replace certain jobs, it will also create opportunities in emerging fields. Understanding the potential risks and benefits of AI in the workforce is crucial to navigating the changing world of employment.uting to a more innovative and dynamic workforce.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91bcacdef247" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>