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
Air at 1 atm enters a thin-walled ( 5-mm diameter) long tube ( 2 m) at an inlet temperature of 100°C. A constant heat flux is ap
alexdok [17]

Answer:

heat rate   = 7.38 W

Explanation:

Given Data:

Pressure = 1atm

diameter (D) = 5mm = 0.005m

length = 2

mass flow rate (m) = 140*10^-6 kg/s

Exit temperature = 160°C,

At 400K,

Dynamic viscosity (μ) = 22.87 *10^-6

Prandtl number (pr) = 0.688

Thermal conductivity (k) = 33.65 *10^-3 W/m-k

Specific heat (Cp) = 1.013kj/kg.K

Step 1: Calculating Reynolds number using the formula;

Re = 4m/πDμ

     = (4*140*10^-6)/(π* 0.005*22.87 *10^-6)

     = 5.6*10^-4/3.59*10^-7

     = 1559.

Step 2: Calculating the thermal entry length using the formula

Le = 0.05*Re*Pr*D

Substituting, we have

Le = 0.05 * 1559 * 0.688 *0.005

Le = 0.268

Step 3: Calculate the heat transfer coefficient  using the formula;

Nu = hD/k

h = Nu*k/D

Since Le is less than given length, Nusselt number (Nu) for fully developed flow and uniform surface heat flux is 4.36.

h = 4.36 * 33.65 *10^-3/0.005

h = 0.1467/0.005

h = 29.34 W/m²-k

Step 4: Calculating the surface area using the formula;

A = πDl

   =π * 0.005 * 2

    =0.0314 m²

Step 5: Calculating the temperature Tm

For energy balance,

Qc = Qh

Therefore,

H*A(Te-Tm) = MCp(Tm - Ti)

29.34* 0.0314(160-Tm) =  140 × 10-6* 1.013*10^3 (Tm-100)

0.921(160-Tm) = 0.14182(Tm-100)

     147.36 -0.921Tm = 0.14182Tm - 14.182

1.06282Tm = 161.542

Tm = 161.542/1.06282

Tm = 151.99 K

Step 6: Calculate the rate of heat transferred using the formula

Q = H*A(Te-Tm)

   = 29.34* 0.0314(160-151.99)

  = 7.38 W

the Prandtl number using the formula

5 0
3 years ago
We have a credit charge that is trying to process but we do not remember signing up and email login is not working? Is there a w
Dmitry_Shevchenko [17]

Answer:

<u>Yes</u>

Explanation:

In such a case, one way to check the <em>credit charge</em> is to <u>contact your bank, </u>doing so would allow the bank to check your account properly to determine where the transaction was originated from.

Another way you could check is to contact the online merchant where such a transaction was initiated.

6 0
3 years ago
34. What does the D stand for in the EVADE acronym?
rewona [7]

Answer:

Even

Vicious

Animal

Die

Equally

Explanation: im jk... but its "Designate and enforce scene control zones"

3 0
4 years ago
What is a dynamic load? *
alexira [117]
Answer: Bricks in Building
8 0
3 years ago
"Vehicles begin to arrive at a parking lot at 6:00 A.M. at a rate of eight per minute. Due to an accident on the access highway,
marin [14]

Answer:

The solution and explanation is attached.

Explanation:

8 0
3 years ago
Other questions:
  • A 15-kg iron block initially at 280°C is quenched in an insulated tank that contains 100 kg of water at 18? Assuming the water t
    5·1 answer
  • A three-phase line has a impedance of 0.4+j2.7 per phase. The line feeds 2 balanced three-phase loads that are connected in para
    6·1 answer
  • What is the effect of the workpiece specific cutting energy on the cutting forces, and why?
    5·1 answer
  • 2. A Class B fire includes burning:
    8·1 answer
  • Design a non-inverting amplifier so that it has a gain of +48 (this gain is positive). Pick resistor values that you have in the
    15·1 answer
  • How does distribution add value to goods and services being sold,
    8·2 answers
  • Which type of turbocharger has a wastegate?
    12·1 answer
  • How do cars moves? and explain Please.
    7·1 answer
  • A set of drawings for a building usually includes plan views of the site (lot), the floor layout, and the ____.
    11·1 answer
  • Engineers designed a motorcycle helmet from a long-lasting and safe material that protects the wearer from accidents and excessi
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!