【问题标题】:Pseudocode for converting NFA to DFANFA转DFA的伪代码
【发布时间】:2012-08-10 21:36:16
【问题描述】:

正如标题所示,我希望有人帮助我编写 NFA 到 DFA 的转换的代码。我只需要伪代码。我尝试使用谷歌搜索,甚至找到了整个源代码,但是几乎没有资源可以帮助我给我一个正式的方法(用书面文字,而不是通过图片)进行转换。这是一道作业题,而且我已经过了截止日期,所以在这里我真的需要一些利他主义。

谢谢。

【问题讨论】:

    标签: dfa nfa


    【解决方案1】:

    我已经写了一篇关于这个主题的文章。

    Converting a NFA to a DFA by subset construction

    它还包含有关如何进行转换的伪代码。

    算法基本上是,从NFA的起始状态开始:

    Perform closure on the current state set
    For each input symbol do the GOTO operation on the closure set.
       If the state set you get from the GOTO is not empty
          Do a closure of the state set.
          If it is a new set of states:
             add a transition between the state sets on the input 
             repeat the entire operation on this new set
          Else
             add a transition between the state sets on the input
    

    执行此操作,直到不再添加任何集合或过渡。这是一个很难解释的算法,但如果你完成了CLOSUREGOTO 这两个基本操作,这并不难。

    【讨论】:

      猜你喜欢
      • 2011-08-16
      • 2013-01-28
      • 1970-01-01
      • 2019-10-18
      • 2019-03-14
      • 1970-01-01
      • 2014-10-23
      • 2011-12-07
      相关资源
      最近更新 更多