<?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 Prathamesh Dhorage on Medium]]></title>
        <description><![CDATA[Stories by Prathamesh Dhorage on Medium]]></description>
        <link>https://medium.com/@prathamesh.dhorage21?source=rss-db895c530248------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Pv4lmgkLQh78e8AU</url>
            <title>Stories by Prathamesh Dhorage on Medium</title>
            <link>https://medium.com/@prathamesh.dhorage21?source=rss-db895c530248------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 06:52:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prathamesh.dhorage21/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[P vs NP Problem]]></title>
            <link>https://medium.com/@prathamesh.dhorage21/p-vs-np-problem-4fdb94b46ec7?source=rss-db895c530248------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fdb94b46ec7</guid>
            <category><![CDATA[np-hard]]></category>
            <category><![CDATA[satisfiab]]></category>
            <category><![CDATA[non-deterministic]]></category>
            <category><![CDATA[deterministic]]></category>
            <category><![CDATA[p-vs-np]]></category>
            <dc:creator><![CDATA[Prathamesh Dhorage]]></dc:creator>
            <pubDate>Mon, 01 May 2023 17:51:13 GMT</pubDate>
            <atom:updated>2023-05-01T20:04:56.819Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>The P versus NP problem is a significant challenge in computer science and mathematics that has yet to be solved. At its core, the problem asks whether a computer can efficiently solve problems that may take an exponentially larger amount of time to solve through brute force. Specifically, the problem examines the relationship between two classes of problems: P, which are problems that can be computed in polynomial time, and NP, which are problems that can be computed in polynomial time. If P and NP are equivalent, then it suggests that any problem that can be verified efficiently can also be solved efficiently. Despite numerous attempts to solve it, the P versus NP problem remains one of the most elusive unclosed problems in computer science and mathematics.</p><p><strong>What are complexity classes?</strong></p><p>Complexity classes are a fundamental concept in computer science that help classify problems based on the amount of computational resources needed to solve them. In general, these resources can refer to time, space, or other measures of efficiency. One of the most well-known complexity classes is P, which refers to problems that can be computed in polynomial time. This means that the amount of time required to compute the problem increases at most as a polynomial function of the input size. Another important complexity class is NP. NP problems are those that can be computed in polynomial time by a non-deterministic algorithm, but for which no efficient deterministic algorithm is discovered. These classes and others like them help us understand the limits of computation and the difficulty of various problems.</p><p>· <strong>P-class Problems</strong></p><p>P problems are those problems that can be computed in polynomial time using deterministic algorithms. Usually, most of them are P problems. Searching an element in the array, inserting an element at the end of a linked list, sorting data using selection sort.</p><p>Examples of P class Problems:</p><ol><li>Insertion sort — O(n²)</li><li>Linear search — O(n)</li><li>Matrix multiplication — O(n³)</li><li>Finding minimum and maximum elements from the array</li></ol><p>· <strong>NP-Class of Problems</strong></p><p>NP refers to a list of computational problems that can be computed in polynomial time using a theoretical computer that can try all possible solutions at once. NP does not mean non-polynomial, as this is a common misconception. However, many NP problems are considered hard or intractable for classical computers. Researchers are working on finding new algorithms to solve NP problems more efficiently.</p><ol><li>Knapsack problem (O(2^n))</li><li>Travelling salesman problem (O(n!))</li><li>Tower of Hanoi (O(2^n — 1))</li><li>Hamiltonian cycle (O(n!))</li></ol><p><strong>What are Deterministic and Non-Deterministic Algorithms?</strong></p><p><strong>Deterministic Algorithms</strong></p><p>A deterministic algorithm are set of rules or procedures, whether mathematical or computational, that generate an expected output without any random or unpredictable results. This means that for a specific input, deterministic algorithm will always producesame output. The term “deterministic” implies that the algorithm’s output solely depends on the input and the rules followed by it. As a result, deterministic algorithms find applications in fields such as computer science, physics, and mathematics. One of the advantages of deterministic algorithms is their simplicity and ease of understanding and implementation. Since the output is predictable, it becomes easy to test and verify the correctness of the algorithm. However, it’s important to recognize that deterministic algorithms are not always the optimal choice. In certain cases, non-deterministic algorithms that can produce random or probabilistic results may be more suitable. For instance, in machine learning, non-deterministic algorithms are often used for training models and making predictions.</p><p><strong>Non-Deterministic Algorithm</strong></p><p>Non-deterministic algorithms are computational or mathematical procedures that can generate various possible outputs for a given input. These algorithms may incorporate probability or randomness in their operations, which can lead to different outcomes every time they are executed.Non-deterministic algorithms find applications in fields like computational complexity theory, artificial intelligence, cryptography, and game theory. Probabilistic algorithms are often more efficient in these areas than deterministic ones, as they can handle complex and unpredictable scenarios.For instance, consider a game such as poker, where the moves of a player are determined by both chance and strategy. A non-deterministic algorithm can simulate different hands and predict the best possible move for a particular set of cards.However, the randomness in non-deterministic algorithms can also make them more challenging to design and analyze. Since the output is not entirely predictable, it can be difficult to verify their correctness or ensure their consistency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bw9qMj3sCrfnF7wtm-4tSA.png" /></figure><p><strong>Non-deterministic algorithm in the field of Computation Complexity theory</strong></p><p>Non-deterministic algorithms play a crucial role in computational complexity theory, particularly in solving problems classified as NP problems. NP problems are those that can be verified in polynomial time, but their solutions may not necessarily be computable in polynomial time using deterministic algorithms. On-deterministic algorithms can solve NP problems by searching through the solution space in a non-deterministic way, trying out different paths until a valid solution is found or it is determined that no solution exists. The advantage of using non-deterministic algorithms to solve NP problems is their potential to find solutions much faster than deterministic algorithms. This is because they can explore multiple potential solutions simultaneously, rather than searching through them one by one.</p><p>Example of a non-deterministic algorithm to search an element in an array</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*yfrwoD222YTaDcLCZmAeVg.png" /></figure><p>The NSearch algorithm is a simple example of a non-deterministic algorithm that searches for a key in an array A of n elements. The algorithm works by randomly choosing an index j from the array A using the choice function. If the value of the key at the chosen index j matches the desired key, the algorithm writes the index j and indicates success using the success function. Otherwise, the algorithm writes 0 to indicate that the key was not found and indicates failure using the failure function. The choice function is used to randomly select an index j from the array A, and the success and failure functions are used to indicate whether or not the key was found in the array. Note that because the NSearch algorithm is non-deterministic, it does not guarantee that the key will be found, even if it is present in the array. However, by using the choice function to randomly select an index, the algorithm can potentially find the key faster than a deterministic algorithm that searches through the array sequentially.</p><p><strong>What is Satisfiability?</strong></p><p>We will find some relationship between all these exponential problems such that if one problem is solved it should be easy for solving other problems also in polynomial time, so that we will not need to work on each and every problem individually. To relate them we need some base problem.</p><p>One of the central concepts in the P vs. NP problem is the idea of Satisfiability. Satisfiability is a CNF formula that is it is a propositional Calculus Formula using Boolean variables. Satisfiability is the problem of determining whether a given logical formula can be satisfied by assigning truth values to its variables. For example:formula (A AND B) OR (NOT C) is satisfiable because it can be made true by assigning A and B to true and C to false. However, the formula (A AND B) AND (NOT A) is not satisfiable, because there is no truth values to A and B that makes it true.</p><p>Example of Satisfiability Problem</p><p>We want to determine if the following logical formula is satisfiable:</p><p>Formula = (A OR B) AND (B OR C) AND (NOT A OR NOT C)</p><p>To determine if this formula is satisfiable, we need to consider all possible truth assignments to A, B, and C. Since there are three variables, each with two possible truth values (true or false), there are a total of eight possible truth assignments.</p><p>We can show these eight possibilities using State Space Tree, in which each path from root node to leaf node will be a possible combination of values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*jI-aueL78BzXJeYkO4PxkQ.jpeg" /></figure><p>If we try each of these eight possible truth assignments and evaluate the formula, we find that there is no truth values to A, B, and C that makes the formula true. Therefore, we can conclude that the formula is not satisfiable.</p><p>While this example may seem simple,problem of determining whether a logical formula is satisfiable quickly becomes more difficult as the number of variables and the complexity of the formula increase. In fact, the satisfiability problem is NP-complete, meaning that if we can efficiently solve it, we can efficiently solve any problem in NP (including many real-world problems such as scheduling, routing, and resource allocation).Now if we take a exponential problem and relate this with the satisfiability problem.Let us take the 0/1 knapsack problem which is also a Boolean based problem which aims for maximum profitability.If we again go with three Boolean variables then again there will be eight possibilities and thus again we can represent it in the form of State Space Tree.Thus similarly we can relate all exponential time taking problems in and if we solve any of those in polynomial time then we can also solve others too.There are also many more ways to find relation, this was one of the way to find relation.</p><p><strong>NP-Hard Problems</strong></p><p>NP-hard problems are a set of computational problems that are believed to be practically unsolvable using efficient algorithms. One of the most well-known NP-hard problems is the satisfiability problem, which asks whether a given Boolean formula can be satisfied by assigning truth values to its variables.</p><p><strong>Exponential Time Problems</strong></p><p>1. 0/1 Knapsack</p><p>2. Traveling SP</p><p>3. Sum of Subsets</p><p>4. Graph Coloring</p><p>5. Hamiltonian Cycle</p><p>· <strong>Reducing Satisfiability</strong></p><p>Satisfiability is NP-Hard and if we are able to reduce satisfiability into Some problem ,then that problem also becomes NP-Hard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*4sb4y0fN0zAPd4P19nOzXw.png" /></figure><p>Moreover, this reduction is transitive in nature, which means that if we can reduce the satisfiability problem into any exponential problem, then that problem also becomes NP-hard.</p><p><strong>NP-Complete</strong></p><p>When a problem is both NP-hard and in NP, it is classified as an NP-complete problem. To show that a problem is NP-complete, we need to prove that it is in NP and that it is also NP-hard. One way to do this is by deriving a non-deterministic algorithm for the problem. This algorithm would run in polynomial time and would correctly solve the problem when given the right input. The existence of such an algorithm would demonstrate that the problem is in NP. If we can also show that the problem is NP-hard, then it is classified as an NP-complete problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*U__mZsHwxs7-w-IhCXFMpw.png" /></figure><p>In summary, NP-hard problems are computationally challenging problems that are believed to be practically unsolvable using efficient algorithms. The satisfiability problem is an example of an NP-hard problem, and any problem that can be reduced to it is also considered NP-hard. If a problem is both NP-hard and in NP, it is classified as an NP-complete problem. Deriving a non-deterministic algorithm for an NP-hard problem is one way to prove that it is NP-complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*T3XfUwHWzY6FKV7jP89stA.png" /></figure><p><strong>To Do Research on Any Problem one needs to do Two things….</strong></p><p>1. Show that the Problem is directly or indirectly related to satisfiability.</p><p>2. Write a Non-Deterministic Algorithm for the Problem</p><p><strong>Conclusion</strong></p><p>In conclusion, the P vs. NP problem is one of the most significant open problems in computer science and mathematics that asks whether certain problems can be solved efficiently by a computer or not. Complexity classes like P and NP are used to classify problems based on the amount of computational resources needed to solve them. Deterministic algorithms always produce the same output for a specific input, while non-deterministic algorithms can generate various possible outputs for a given input. Non-deterministic algorithms are particularly useful in solving NP problems in computational complexity theory, where they can explore multiple potential solutions simultaneously. Satisfiability is the relationship between all these exponential problems, where solving one problem should be easy for solving other problems.</p><p><strong>Co-Authors :-</strong></p><ol><li><a href="https://medium.com/u/a8f283021445">Om Dhumal</a></li><li><a href="https://medium.com/u/d991bb957bde">Divyanshu Jha</a></li><li><a href="https://medium.com/u/e5b6c43aae2d">Dhruv Thakkar</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fdb94b46ec7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>