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
2.11 Consider a 400 mm × 400 mm window in an aircraft. For a temperature difference of 90°C from the inner to the outer surface
alexandr402 [8]

Answer:

The heat loss rate through one of the windows made of polycarbonate is 252W. If the window is made of aerogel, the heat loss rate is 16.8W. If the window is made of soda-lime glass, the heat loss rate is 1190.4W.

The cost associated with the heat loss through the windows for an 8-hour flight is:

For aerogel windows: $17.472 (most efficient)

For polycarbonate windows: $262.08

For soda-lime glass windows: $1,238.016 (least efficient)

Explanation:

To calculate the heat loss rate through the window, we can use a model of heat transmission by conduction throw flat wall. Using unidimensional Fourier law:

\frac{dQ}{dt}=\dot Q =-kS\nabla \vec{T}

In this case:

\dot Q =k\frac{S}{L} \Delta T

If we replace the data provided by the problem we get the heat loss rate through one of the windows of each material (we only have to change the thermal conductivities).

To obtain the thermal conductivity of the soda-lime glass we use the graphic attached to this answer (In this case for soda-lime glass k₃₀₀=0.992w/m·K).

To calculate the cost associated with the heat loss through the windows for an 8-hour flight we use this formula (using the heat loss rate calculated in each case):

Cost=C_{hc}\cdot \dot Q \cdot t \cdot n=1\frac{\$}{Kwh} \cdot \dot Q \cdot 8h \cdot 130

6 0
3 years ago
When was solar power envold ​
Lyrx [107]

Answer:

1839

Explanation:

the first huge step in solar penal technology came when alxendare becquerel observed the photovolatic effect in 1839,which occurs when a material produces electric current when exposed to light.it was not untill 1888 that the first solar cell was actually built by aleksander stoletov.

5 0
3 years ago
Read 2 more answers
One cylinder in the diesel engine of a truck has an initial volume of 650 cm3 . Air is admitted to the cylinder at 35 ∘C and a p
kupik [55]

Answer:

1) the final temperature is T2 = 876.76°C

2) the final volume is V2 = 24.14 cm³

Explanation:

We can model the gas behaviour as an ideal gas, then

P*V=n*R*T

since the gas is rapidly compressed and the thermal conductivity of a gas is low a we can assume that there is an insignificant heat transfer in that time, therefore for adiabatic conditions:

P*V^k = constant = C, k= adiabatic coefficient for air = 1.4

then the work will be

W = ∫ P dV = ∫ C*V^(-k) dV = C*[((V2^(-k+1)-V1^(-k+1)]/( -k +1) = (P2*V2 - P1*V1)/(1-k)= nR(T2-T1)/(1-k) = (P1*V1/T1)*(T2-T1)/(1-k)

W = (P1*V1/T1)*(T2-T1)/(1-k)  

T2 = (1-k)W* T1/(P1*V1) +T1

replacing values (W=-450 J since it is the work done by the gas to the piston)

T2 = (1-1.4)*(-450J) *308K/(101325 Pa*650*10^-6 m³) + 308 K= 1149.76 K = 876.76°C

the final volume is

TV^(k-1)= constant

therefore

T2/T1= (V2/V1)^(1-k)

V2 = V1* (T2/T1)^(1/(1-k)) = 650 cm³ * (1149.76K/308K)^(1/(1-1.4)) = 24.14 cm³

3 0
3 years ago
From the following numbered list of characteristics, decide which pertain to (a) precipitation hardening, and which are displaye
Blababa [14]

Answer:

(a) Precipitation hardening

(1) The strengthening mechanism involves the hindering of dislocation motion by precipitates/particles.

(2) The hardening/strengthening effect is not retained at elevated temperatures for this process.

(4) The strength is developed by a heat treatment.  

(b) Dispersion strengthening

(1) The strengthening mechanism involves the hindering of dislocation motion by precipitates/particles.  

(3) The hardening/strengthening effect is retained at elevated temperatures for this process.

(5) The strength is developed without a heat treatment.  

7 0
3 years ago
The Hoover Dam is 221 m tall and 379 m wide. Approximating it as a flat plate, determine the effective resultant force on the da
IrinaVladis [17]

Answer:

2165800 Pa

Explanation:

See it in the pic.

3 0
3 years ago
Other questions:
  • Heat in the amount of 100 kJ is transferred directly from a hot reservoir at 1200 K to a cold reservoir at 600 K. Calculate the
    15·1 answer
  • What is the purpose of a heater core
    5·2 answers
  • Nguyên lý hoạt động của kim phun
    7·1 answer
  • Consider a circuit element, with terminals a and b, that has vab= -12V and iab= 3A. Over a period of 2 seconds, how much charge
    8·1 answer
  • Who else hates this because i do
    12·2 answers
  • Technician A says that acid core solder should be used whenever aluminum wires are to be soldered.
    14·1 answer
  • A tiger cub has a pattern of stripes on it for that is similar to that of his parents where are the instructions stored that pro
    8·1 answer
  • 10.16.1: LAB: Interstate highway numbers (Python)
    9·1 answer
  • Select the correct answer. Which of the following devices is a simple machine? A.
    9·2 answers
  • The project's criteria.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!