1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andreas93 [3]
3 years ago
6

Create a C language program that can be used to construct any arbitrary Deterministic Finite Automaton corresponding to the FDA

definition above. a. Create structs for the: automaton, a state, and a transition. For example, the automaton should have a "states" field, which captures its set of states as a linked list.
Engineering
1 answer:
otez555 [7]3 years ago
5 0

Answer:

see the explanation

Explanation:

/* C Program to construct Deterministic Finite Automaton */

#include <stdio.h>

#include <DFA.h>

#include <stdlib.h>

#include <math.h>

#include <string.h>

#include <stdbool.h>

struct node{

struct node *initialStateID0;

struct node *presentStateID1;

};

printf("Please enter the total number of states:");

scanf("%d",&count);

//To create the Deterministic Finite Automata

DFA* create_dfa DFA(){

  q=(struct node *)malloc(sizeof(struct node)*count);

  dfa->initialStateID = -1;

  dfa->presentStateID = -1;

  dfa->totalNumOfStates = 0;

  return dfa;

}

//To make the next transition

void NextTransition(DFA* dfa, char c)

{

  int tID;

  for (tID = 0; tID < pPresentState->numOfTransitions; tID++){

       if (pPresentState->transitions[tID].condition(c))

      {

          dfa->presentStateID = pPresentState->transitions[tID].toStateID;

          return;

      }

  }

  dfa->presentStateID = pPresentState->defaultToStateID;

}

//To Add the state to DFA by using number of states

void State_add (DFA* pDFA, DFAState* newState)

{  

  newState->ID = pDFA->numOfStates;

  pDFA->states[pDFA->numOfStates] = newState;

  pDFA->numOfStates++;

}

void transition_Add (DFA* dfa, int fromStateID, int(*condition)(char), int toStateID)

{

  DFAState* state = dfa->states[fromStateID];

  state->transitions[state->numOfTransitions].toStateID = toStateID;

  state->numOfTransitions++;

}

void reset(DFA* dfa)

{

  dfa->presentStateID = dfa->initialStateID;

}

You might be interested in
50.38
inysia [295]

Answer:

NOT OSHA

Explanation:

4 0
3 years ago
Identify five safety hazards that should be included in the design of the school
erik [133]

Answer:

1) function of fire doors and making sure theyre properly wired to fire alarms

2) proper water piping and purifaction for water fountains and sinks.

3)  falty sprinkler systems/rsuty sprikler systems that wont work

4) weather durable roofing and walls for storms and snow depending on were your located .

5) rsuted pipes in showers or fountains that could give you tetnus or other disaeases

Explanation:

HOPE THIS HELPS good luck!!

7 0
3 years ago
Technician a says that diesel engines can produce more power because air in fuel or not mix during the intake stroke. Technician
mariarad [96]

Answer:

Technician be says that diesel engines produce more power because they use excess air to burn feel who is correct

Explanation:

He is correct as many engines are run by diesel. It produces more power as that is how cars produce more power.

3 0
2 years ago
What was the purpose of the vasa ship
goldfiish [28.3K]
The main purpose was for power. The vessel has come to symbolize Sweden's Great Power Period, when the nation became a major European power and controlled much of the Baltic.
8 0
3 years ago
Input Energy ---&gt; Output Energy
uranmaximum [27]

Answer:

motion ------> electrical. winds push the turbines which generate a magnetic fields which in turn, generates electricity

4 0
3 years ago
Other questions:
  • Stainless steel ball bearings (rho = 8085 kg/m3 and cp = 0.480 kJ/kg·°C) having a diameter of 1.2 cm are to be quenched in water
    10·2 answers
  • Required information NOTE: This is a multi-part question. Once an answer is submitted, you will be unable to return to this part
    9·1 answer
  • A combined gas-steam power cycle uses a simple gas turbine for the topping cycle and a simpleRankine cycle for the bottoming cyc
    8·1 answer
  • Which of the following is part of the highway
    11·2 answers
  • You must yield the right-of-way to all of the following EXCEPT:
    8·1 answer
  • In 2009 an explosive eruption covered the island of Hunga Ha'apai in black volcanic ash. What type of succession is this?
    7·1 answer
  • How many kg moles of Sodium Sulphate will contain 10 kg of<br> Sodium?
    10·2 answers
  • Who invented a control unit for an artificial heart?<br> ements<br> ante
    8·1 answer
  • What are the purpose of studying the strength of materials and testing.
    5·1 answer
  • As a worker in this field you would:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!