<?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 Atharva Mugalikar on Medium]]></title>
        <description><![CDATA[Stories by Atharva Mugalikar on Medium]]></description>
        <link>https://medium.com/@atharva.mugalikar20?source=rss-dfe9e56602bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vW51yOjPoBg9dWP-</url>
            <title>Stories by Atharva Mugalikar on Medium</title>
            <link>https://medium.com/@atharva.mugalikar20?source=rss-dfe9e56602bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 10:05:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@atharva.mugalikar20/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[Nondeterminism in Theory of Computation.]]></title>
            <link>https://medium.com/@atharva.mugalikar20/nondeterminism-in-theory-of-computation-b60b9a70ce84?source=rss-dfe9e56602bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/b60b9a70ce84</guid>
            <category><![CDATA[theory-of-computation]]></category>
            <category><![CDATA[automata]]></category>
            <category><![CDATA[turing-machine]]></category>
            <dc:creator><![CDATA[Atharva Mugalikar]]></dc:creator>
            <pubDate>Sat, 25 Jun 2022 17:16:00 GMT</pubDate>
            <atom:updated>2022-06-28T04:08:02.634Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Authors: Bhushan Hatwar, Bhushan Laddha, Sakshi Bothe, Atharva Mugalikar.</em></blockquote><p>In this article, we’ll be looking into details portrayed by Nondeterminism in the vast and interesting field of computation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*Xsm9V7wR3_ojKbfw8V2r1A.png" /><figcaption>Figure [1]: Source: cs.wcupa.edu</figcaption></figure><h3>What is meant by Nondeterminism?</h3><p>Nondeterminism is a crucial concept in computer science which appears in various contexts such as concurrent computation, algorithms and automata. Nondeterministic algorithms, even for the same input, can present different behaviours on particular turns. Nondeterministic algorithms are used when we’re required to find an approximation for a solution, when the accurate and “perfect” solution would be too costly in terms of computation to obtain if we use a deterministic algorithm.</p><p>A nondeterministic algorithm has the ability to land on outcomes using several routes. As <em>image[1]</em> represents, nondeterministic algorithm shows a single path branching into several parts. The interesting part is that out of all the paths, some would arrive at the same output while some may arrive at different unique outputs. To help us understand better, let us imagine a scenario which includes a person walking through a dense forest which includes several branching paths which the person can choose.</p><p>Every time the person strolls further into the forest, paths fork out into different routes to take and they must pick the path. These algorithms do not ensure and guarantee a perfect solution. They don’t arrive at a solution for every computational path they take. However, they are always bound to arrive at a correct solution at some probable path. Hence, In the scenario we imagined earlier, the person walking through the forest may only find their desired destination if they pick some route of “correct” forked paths.</p><h3>Nondeterministic Finite Automata (NFA):</h3><p>NFA bears the ability to be in several states at once. This ability is widely explained as the ability to “guess” from its inputs. For example, when the machine is used to search for a sequence of characters or keywords in a textual string, it is better to “guess” or estimate that we are at the beginning of atleast one of those sequence of states to check if the string is reached.</p><p>Now, let us see the formal notations used for denoting nondeterministic finite automata. An NFA is represented as <strong>A = (<em>Q, Σ, δ, q0, F</em>)</strong></p><p>where,</p><p>1. <em>Q</em> is a finite set of states.</p><p>2. <em>Σ</em> is a finite set of input symbols.</p><p>3. <em>q0</em>, is a member of <em>Q</em>, and is the start state.</p><p>4. <em>F</em>, a subset of <em>Q</em>, is the set of final or accepting states.</p><p>5. <em>δ, </em>the the transition function is a function that takes a state in Q and an<br> input symbol in <em>Σ </em>as arguments and returns a subset of Q.</p><p><strong>Let us see an example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*8dD_hvBnpwwV_3Rm_jflqg.png" /><figcaption>Figure [2]: An NFA that accepts all strings that end with 01.</figcaption></figure><p>The NFA of the above figure can be denoted as</p><p>({q0, q1, q2}, {0, 1}, <em>δ, </em>q0, {q2}) where the transition function <em>δ </em>can be represented with a transition table as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*v0hDBRY2dR8Li9vLN8iSBA.png" /><figcaption>Figure [3]: Transition table for NFA that accepts all strings ending with 01.</figcaption></figure><h3>Nondeterministic Pushdown Automata (NPDA):</h3><p>NPDA is like Nondeterministic Finite Automata which is mentioned earlier in the article, except it has a memory in the form of a stack where an arbitrary amount of information can be stored. The context free grammar which accepts Pushdown Automata accepts Nondeterministic Pushdown Automatas as well. Although there are some context free grammars which can be computed by NPDAs and not PDAs. Hence, we can say that NPDAs are more capable and powerful than PDAs.</p><p>NPDA can be explained as:</p><p>1. A finite state of <em>Q</em> states.</p><p>2. A finite set of <em>Σ</em> input alphabets.</p><p>3. A finite set Γ which is called the stack alphabet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/0*xdzoU8hmmTaOvR29.jpg" /><figcaption>Fig[4]: Nondeterministic Pushdown Automata.</figcaption></figure><h4>Stack Operations:</h4><ol><li>Pop operation: Reads the symbol present at the top of the stack.</li><li>Push operation: writes a symbol onto the top of the stack.</li><li>Stack memory follows Last In, First Out (LIFO) method.</li></ol><h4>Understanding through an example:</h4><p>Designing a PDA for palindrome strings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/0*-35wk7B3afNRKKQR.png" /><figcaption>Fig [5]: NDFA for Palindrome strings.</figcaption></figure><p>This PDA is a nondeterministic PDA because finding the mid for the given string and reading the string from left and matching it with from right (reverse) direction leads to non-deterministic moves. Here, we will push a symbol onto the stack till half of the string then we will read each symbol and then perform the pop operation. We will compare to see whether the symbol which is popped is similar to the symbol which is read. Once we reach to end of the input, we expect the stack to be empty.</p><h3>Nondeterministic Turing Machine (NTM):</h3><p>In NTM, there are sets of operations for every symbol and state, hence, the transitions here are nondeterministic. NTMs are sometimes used in thought experiments to examine the abilities and limits of computers. IN broader context, Turing machines are imagined to be a computer that read and write symbols sequentially on an endless tape of inputs by meticulously following a defined set of rules for the specific case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*M-deM7QvBvVnGMRwNHovfw.png" /><figcaption>Figure [6]: Nondeterministic Turing Machine (<a href="https://en.wikipedia.org/wiki/Nondeterministic_Turing_machine">Source</a>)</figcaption></figure><p>The working of a NTM can be described using a tree structure as follows,</p><p>An input is accepted once there is minimum one node of tree which is accepting the case, or else it is rejecting. If all branches of the tree halt on all inputs, the NTM is called a decider and if all the branches are rejected, the input is rejected as well. A NTM can be denoted as <strong>A = (<em>Q, X, Σ, δ, q0, B, F</em>)</strong></p><p>where,</p><p>1. <strong>Q</strong> is a finite set of states.</p><p>2. <strong>X</strong> is the tape alphabet.</p><p>3. <strong><em>Σ</em></strong> is the input alphabet.</p><p>4. <strong>δ</strong> is a transition function; δ : Q × X → P(Q × X × {Left_shift, Right_shift}).</p><p>5. <strong>q0</strong> is the initial state.</p><p>6. <strong>B</strong> is the blank symbol.</p><p>7. <strong>F</strong> is the set of final states.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*5IBct24wHfJbI90mtSU0ow.png" /><figcaption>Figure [7]: Nondeterministic Turing Machine Computation.</figcaption></figure><h3>Difference between Deterministic Finite Automata (DFA) and Nondeterministic Finite Automata (NFA):</h3><h4>DFA Characteristics:</h4><p>1. The transition from a state is to a single particular next state for each input symbol. Hence it is called <em>deterministic</em>.</p><p>2. Requires more space.</p><p>3. Empty string transitions are not seen in DFA.</p><p>4. A string is accepted by a DFA, if it transits to a final state.</p><p>5. Backtracking is allowed in DFA.</p><h4>NFA Characteristics:</h4><p>1. The transition from a state can be to multiple next states for each input symbol. Hence it is called <em>non-deterministic.</em></p><p>2. Requires less space.</p><p>3. NFA allows empty string transitions.</p><p>4. A string is accepted by a NFA, if at least one of all possible transitions ends in a final state.</p><p>5. Backtracking is not always possible in NFA.</p><h3>NDFA to DFA conversion:</h3><p>Since we’re now familiar with the definitions and differenced between NDFA and DFA, let us explore the process followed behind converting NDFA to DFA.</p><h4>Example:</h4><p>Let <strong>X = (Qx, ∑, δx, q0, Fx)</strong> be an NDFA which accepts a language L(X). We have to design an equal DFA <strong>Y = (Qy, ∑, δy, q0, Fy)</strong> so that <strong>L(Y) = L(X)</strong>. The following procedure converts the NDFA to its equivalent DFA.</p><p>We will now proceed by solving the problem while keeping these steps in mind:</p><p>1. Create state table for the NDFA.</p><p>2. Create a blank state table under possible input alphabets for the equivalent DFA.</p><p>3. Mark the start state of the DFA by q0.</p><p>4. Find out the combination of States {Q0, Q1,… , Qn} for each possible input character.</p><p>5. Each time we generate a new state under the input characters columns, we have to apply step 4 again, or move onto step 6.</p><p>6. The states which contain any of the final states of the NDFA are the final states of the equivalent DFA.</p><h4>This could be understood better with an example, the problem statement is:</h4><p>Consider regular expression r, where r = (11 + 111)* over Ʃ = {0, 1}. What are the number of states in minimal NFA and DFA.</p><p>After following the steps mentioned above, the transition diagram would look be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*DhgO7MZJOFoXkTjiqs-uHA.png" /><figcaption>Figure [8]: NFA to DFA converted transition diagram.</figcaption></figure><h3>To Conclude,</h3><p>The decision whether to emphasize the similarities or to concentrate on the differences may depend on the circumstances. Nondeterminism is connected with abstraction of problems and challenges: on one hand, nondeterminism can serve as a mean for achieving abstraction, but, on the other hand, understanding and using nondeterminism requires a certain level of abstraction.</p><p>We’d like to thank the readers for spending the time to read this blog. If you have any thoughts or criticism regarding the content, feel free to mention those in the comments and applaud if this helped you gain some more knowledge about the concept of nondeterminism as a whole.</p><p><em>References:</em></p><p>1. <a href="https://en.wikipedia.org/wiki/Nondeterministic_algorithm"><strong>Nondeterministic algorithm — Wikipedia</strong></a></p><p>2. <a href="https://www.tutorialspoint.com/automata_theory/index.htm"><strong>Automata Theory Tutorial</strong></a><strong> — Tutorialspoint</strong></p><p>3. <a href="https://en.wikipedia.org/wiki/Nondeterministic_Turing_machine"><strong>Nondeterministic Turing machine — Wikipedia</strong></a></p><p>4. <a href="https://www.codingninjas.com/codestudio/library/non-deterministic-turing-machine"><strong>Non-Deterministic Turing Machine</strong></a><strong> — Codingninjas</strong></p><p>5. <a href="https://www.cs.wcupa.edu/rkline/fcs/nfas.html#def"><strong>Nondeterministic Finite Automata</strong></a><strong> — cs.wcupa.edu</strong></p><p>6. <a href="https://www.tutorialspoint.com/automata_theory/non_deterministic_finite_automaton.htm"><strong>Non-deterministic Finite Automaton</strong></a><strong> — Tutorialspoint</strong></p><p>7. <a href="https://www.sciencedirect.com/topics/computer-science/nondeterminism"><strong>Nondeterminism — Sciencedirec</strong></a><strong>t</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b60b9a70ce84" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>