Question: GOLANGUAGE: Write a concurrent implementation of the Reachable function that returns true if a final state is reachable from the start state after reading an

GOLANGUAGE: Write a concurrent implementation of the Reachable function that returns true if a final state is reachable from the start state after reading an input sequence of symbols.

Code Shell Given:

package nfa

// A nondeterministic Finite Automaton (NFA) consists of states,

// symbols in an alphabet, and a transition function.

// A state in the NFA is represented as an unsigned integer.

type state uint

// An symbol in the NFA is a single rune, i.e. a character.

type symbol rune

// Given the current state and a symbol, the transition function

// of an NFA returns the set of next states the NFA can transition to

// on reading the given symbol.

// This set of next states could be empty.

type TransitionFunction func(st state, sym symbol) []state

// Reachable returns true if there exists a sequence of transitions

// from `transitions` such that if the NFA starts at the start state

// `start` it would reach the final state `final` after reading the

// entire sequence of symbols `input`; Reachable returns false otherwise.

func Reachable(transitions TransitionFunction, start, final state, input []symbol) bool {

// TODO

return false

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!