DFA 和 NFA 的区别

         When I first read 'DFA' and 'NFA', I feel they are very complex. but when I read the concept of them, I found they are very very simple. Not complex at all.
       DFA is acronym of deterministic finite automata. You had better know what is finite automata before trying to know DFA and NFA. An automate is a mathmatical model for finite state machine. I think everyone know finite state machine well.It is just a serial of states and the trigger condition. Finite automate is this kind of state machine which will stop after a certain steps. How doest the state machine transfer state is regulating by its onwer internal  principle and the input.
  An automata is represented by the 5-tuple (set of states, finite set of symbols,transition function, start state, accepted state). You can find the detailed definition at (http://en.wikipedia.org/wiki/Automate_theory).
   The difference between DFA and NFA :
   1. Deterministic finite automate :
    Each state of an automaton of this kind has a transition for every symbol in the alphabet.
   2. Nondeterministic finite automate :
     States of an automaton of this kind may or may not have a transition for each symbol for each symbol in the alphabetet, or can even have multiple for a symbol. If a transition is undefined, so that the automaton doesn't know how to keep on reading the input, the word is rejected.
   
     我的理解就是:
    1.  DFA在任何状态对于任何输入都是有一个明确的处理(state transiton),  而NFA 不然。
    2. 如果输入集合为N,状态几个为M,则DFA 的状态迁移矩阵应该为N X M, 而NFA 的状态迁移矩阵是可以存储裁剪的。
   3. DFA 之所以比 NFA 快是因为DFA 在任何状态都与任何输入的处理都是确定的,而NFA 不能够确定处理(需要借助辅助信息)
   4. 关于 DFA 不支持backtrack 和 NFA 支持 backtrack , 这个不是 DFA 和 NFA 的本质区别,而是由于各自的本质特性导致在实现上的差异而带来的不同效果。就好像是一个没有腿的人,要走路必须做电动车,结果是比有腿走路的人快,所以说没腿的人走的快不是本质的区别。
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值