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
Is a diesel truck less expensive to drive than a gas truck?
MArishka [77]

Answer:

Typically, diesel trucks cost more than those with gas engines, especially when you're first buying them, as diesel is usually featured as an add-on for gas-powered cars. Diesel add-ons can cost over $5,000 for midsize trucks and around $10,000 for heavy-duty trucks.

Explanation:

Make me brain pls

3 0
1 year ago
Assuming that the following three variables have already been declared, which variable will store a Boolean value after these st
Yuki888 [10]

Answer:

C

Explanation:

Boolean Algebra deals with either a one or a zero and how to manipulate them in computers or elsewhere. The "choice" option may not work, since for text it must be enclosed in quotation marks, usually. For "again," it's text and not a 1 or 0. So, the answer is C, since this is a 0.

5 0
3 years ago
What engine does the Lexus is300 have?
Nikitich [7]

Answer:

2jz - ge

Explanation:

it has the non turbo 2jz. its the engine the supra has

6 0
3 years ago
Technician A says that the paper test could detect a burned valve. Technician B says that a grayish white stain on the engine co
Bumek [7]

Answer:

Both Technician A and B are correct.

Explanation: Both are correct, but keep note that different color coolants leave different color  stains.

6 0
2 years ago
Steam at 4 MPa and 350°C is expanded in an adiabatic turbine to 125kPa. What is the isentropic efficiency (percent) of this turb
guajiro [1.7K]

Answer:

\eta_{turbine} = 0.603 = 60.3\%

Explanation:

First, we will find actual properties at given inlet and outlet states by the use of steam tables:

AT INLET:

At 4MPa and 350°C, from the superheated table:

h₁ = 3093.3 KJ/kg

s₁ = 6.5843 KJ/kg.K

AT OUTLET:

At P₂ = 125 KPa and steam is saturated in  vapor state:

h₂ = h_{g\ at\ 125KPa} = 2684.9 KJ/kg

Now, for the isentropic enthalpy, we have:

P₂ = 125 KPa and s₂ = s₁ = 6.5843 KJ/kg.K

Since s₂ is less than s_g and greater than s_f at 125 KPa. Therefore, the steam is in a saturated mixture state. So:

x = \frac{s_2-s_f}{s_{fg}} \\\\x = \frac{6.5843\ KJ/kg.K - 1.3741\ KJ/kg.K}{5.91\ KJ/kg.K}\\\\x = 0.88

Now, we will find h_{2s}(enthalpy at the outlet for the isentropic process):

h_{2s} = h_{f\ at\ 125KPa}+xh_{fg\ at\ 125KPa}\\\\h_{2s} = 444.36\ KJ/kg + (0.88)(2240.6\ KJ/kg)\\h_{2s} = 2416.088\ KJ/kg

Now, the isentropic efficiency of the turbine can be given as follows:

\eta_{turbine} = \frac{h_1-h_2}{h_1-h_{2s}}\\\\\eta_{turbine} = \frac{3093.3\ KJ/kg-2684.9\ KJ/kg}{3093.3\ KJ/kg-2416.088\ KJ/kg}\\\\\eta_{turbine} = \frac{408.4\ KJ/kg}{677.212\ KJ/kg}\\\\\eta_{turbine} = 0.603 = 60.3\%

3 0
3 years ago
Other questions:
  • A 1-lb collar is attached to a spring and slides without friction along a circular rod in a vertical plane. The spring has an un
    6·1 answer
  • What are the basic types of heat exchangers?
    9·1 answer
  • For each of the following stacking sequences found in FCC metals, cite the type of planar defect that exists:
    7·1 answer
  • A process consists of two steps: (1) One mole of air at T = 800 K and P = 4 bar is cooled at constant volume to T = 350 K. (2) T
    7·1 answer
  • A wine aerator is a small, in-bottle, hand-held pour-through or decantor top device using the venturi effect for aerating the wi
    9·1 answer
  • George is replacing a burned out resistor in a circuit board. The board has a 10, a 20, and a 40 on resistor, all in parallel. W
    5·1 answer
  • What are the advantages to a quality<br> saw?
    6·1 answer
  • In a movie theater in winter, 510 people, each generation sensible heat at a rate of 80 W, are watching a movie. The heat losses
    11·1 answer
  • What is government role in the modern American version of capitalism
    11·1 answer
  • Why data structure is important
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!