NFA algrithms