Giter Club home page Giter Club logo

fsm's Introduction

Finite State Machine

Minimization of DFA

We have to deal with disjoint sets in this problem. The algorithm goes as follows:

  • Make two disjoint sets - final and non final
  • check for each pair of elements in the same set. Check if they are distinguishable.
  • If they are distinguishable, then the two elements are in different sets
  • If they are not distinguishable, then the two elements are in the same set (for this iteration)
  • Let the previous DSU state be $D_x$ and the new one be $D_{x+1}$. Repeat the process until $D_x != D_{x+1}$

Checking if two elements are distinguishable

Let the two elements transition to x and y after taking a certain input. If x and y do not belong to the same set then these elements are distinguishable, else they aren't.

REGEX to NFA

We use two main ideas here: Shunting Yard algorithm to convert infix string to postfix, and Thompsons algorithm to convert the postfix to NFA.

The main idea behind Shunting Yard is to get rid of those annoying parentheses. It makes processing the string a lot easier.

Infix to Postfix:

  • Maintain an output string and a stack.
  • If you encounter an alphabet, push it into the stack
  • If you encounter an operator - push/pop according to it's priority

Postfix to NFA:

  • Keep pushing characters into the stack.
  • If you encounter '.' or '+', pop off last two elements off the stack and perform the operation. Then push the result into the stack.
  • If you encounter '*' pop off the last element from the stack and perform the operation. Then push the result back into the stack.

fsm's People

Contributors

jeopardy1234 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.